import java.io._ val writer = new PrintWriter(new File("color.html")) writer write """<table border="1"></tr><td>""" val step = 30 var colnum = 0 val width = 81 for {r <- 0 until 256 by step g <- 0 until 256 by step b <- 0 until 256 by step } { val c = "%02x%02x%02x".format(r, g, b); colnum = colnum + 1 writer write """<td onclick="selectColor('#""" writer write c writer write """')" style="background-color:#""" writer write c writer write """"> </td>""" if (colnum % width == 0) { writer write ("</tr><td>") } } writer write """</tr><td></table>""" writer.close()