Skip to content

Instantly share code, notes, and snippets.

@kamiyaowl
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamiyaowl/497b1ee02ac772a5c851 to your computer and use it in GitHub Desktop.
Save kamiyaowl/497b1ee02ac772a5c851 to your computer and use it in GitHub Desktop.
たまにこういうの欲しくなる
def loopSeq = ((0 to 0xff) ++ (0x0 to 0xff).reverse)
val arr = {loopSeq map{x => s"{ $x, 0, 0,}, "}} ++
{loopSeq map{x => s"{ 0, $x, 0,}, "}} ++
{loopSeq map{x => s"{ 0, 0, $x,}, "}} ++
{loopSeq map{x => s"{ $x, $x, 0,}, "}} ++
{loopSeq map{x => s"{ 0, $x, $x,}, "}} ++
{loopSeq map{x => s"{ $x, 0, $x,}, "}} ++
{loopSeq map{x => s"{ $x, $x, $x,}, "}}
println(arr.mkString("uint8_t color_table[" + arr.size.toString + "][3] = {\r\n", "\r\n\t", "\r\n};"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment