6
For this challenge, you must accept input as a comma-separated list (columns) of a run (rows) of the first letters of any of the colors red
, orange
, yellow
, green
, blue
, or purple
, and output (to stdout) the HTML for a table of those colors.
This is fairly hard to understand, so I'll just give a simple example.
Input:
rgb,gbr,grb
Output (with example screenshot):
<html>
<head>
</head>
<body>
<table>
<tbody>
<tr>
<td style="background-color: red" width="50" height="50"></td>
<td style="background-color: green" width="50" height="50"></td>
<td style="background-color: blue" width="50" height="50"></td>
</tr>
<tr>
<td style="background-color: green" width="50" height="50"></td>
<td style="background-color: blue" width="50" height="50"></td>
<td style="background-color: red" width="50" height="50"></td>
</tr>
<tr>
<td style="background-color: green" width="50" height="50"></td>
<td style="background-color: red" width="50" height="50"></td>
<td style="background-color: blue" width="50" height="50"></td>
</tr>
</tbody>
</table>
</body>
</html>
Note that the HTML you output need not be valid; it just has to work. By "work", I mean that your output will be pasted into a .html
file and viewed in the latest (currently, 9/28/13) Chrome (v 29.0.1547.76). The squares must be 50 pixels width and height. You may have whatever padding between them as you want (Chrome automatically uses 1 pixel of padding, even when you specify padding: 0px
, so I can't control that).
Input will always be valid (letters will be one of roygbp
), but the rows are not guaranteed to have equal amounts of squares in them. For example, roygbp,ooo
is valid and should output
This is code-golf, shortest code wins.
1Table layouts >:( – Ry- – 2013-09-29T02:16:24.800
1@minitech They're not layouts :P and anything goes in code golf :D – Doorknob – 2013-09-29T02:18:34.937