216 Web Safe Color Chart by rails
I like the color chart at 216 Web Safe Color Chart, and try to make one for myself by RoR ActionView. the code is followed:
<% a = %w[ F C 9 6 3 0 ] -%>
<% a.each do |k| -%>
<div class=\"<%= cycle(\'left\', \'right\') -%>\">
<table>
<% a.each do |i| -%>
<tr>
<% a.each do |j| -%>
<% code = k + k + i + i + j + j -%>
<% if code =~ /(\\S\\S)(\\S\\S)(\\S\\S)/ -%>
<% r = $1 -%>
<% g = $2 -%>
<% b = $3 -%>
<% rgb = \'R=\' + r.hex.to_s + \'<br />\' + \'G=\' + g.hex.to_s + \'<br />\' + \'B=\' + b.hex.to_s + \'<br />\' -%>
<% end -%>
<td bgcolor=\"#<%= code -%>\">
<% if i =~ /[036]/ -%>
<font color=\"white\">
#<%= k -%><%= k -%><%= i -%><%= i -%><%= j -%><%= j -%><br />
<%= rgb -%>
</font>
<% else -%>
#<%= k -%><%= k -%><%= i -%><%= i -%><%= j -%><%= j -%><br />
<%= rgb -%>
<% end -%>
</td>
<% end -%>
</tr>
<% end -%>
</table>
</div>
<% end -%>
<% a = %w[ F C 9 6 3 0 ] -%>
<% a.each do |k| -%>
<div class=\"<%= cycle(\'left\', \'right\') -%>\">
<table>
<% a.each do |i| -%>
<tr>
<% a.each do |j| -%>
<% code = k + k + i + i + j + j -%>
<% if code =~ /(\\S\\S)(\\S\\S)(\\S\\S)/ -%>
<% r = $1 -%>
<% g = $2 -%>
<% b = $3 -%>
<% rgb = \'R=\' + r.hex.to_s + \'<br />\' + \'G=\' + g.hex.to_s + \'<br />\' + \'B=\' + b.hex.to_s + \'<br />\' -%>
<% end -%>
<td bgcolor=\"#<%= code -%>\">
<% if i =~ /[036]/ -%>
<font color=\"white\">
#<%= k -%><%= k -%><%= i -%><%= i -%><%= j -%><%= j -%><br />
<%= rgb -%>
</font>
<% else -%>
#<%= k -%><%= k -%><%= i -%><%= i -%><%= j -%><%= j -%><br />
<%= rgb -%>
<% end -%>
</td>
<% end -%>
</tr>
<% end -%>
</table>
</div>
<% end -%>
<< Home