Skip to content

Instantly share code, notes, and snippets.

@sfiera
Created February 28, 2013 05:39
Show Gist options
  • Save sfiera/5054495 to your computer and use it in GitHub Desktop.
Save sfiera/5054495 to your computer and use it in GitHub Desktop.
k = [255, 240, 224, 208, 192, 176, 160, 144, 128, 112, 96, 80, 64, 48, 32, 16]
coeff = [
(255, 255, 255),
(255, 128, 0),
(255, 255, 0),
( 0, 0, 255),
( 0, 255, 0),
(128, 0, 255),
(128, 128, 255),
(255, 128, 128),
(255, 255, 128),
( 0, 255, 255),
(255, 0, 128),
(128, 255, 128),
(255, 128, 255),
( 0, 128, 255),
(239, 233, 195),
(255, 0, 0),
]
ambient = [
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
( 0, 0, 0),
(16, 15, 12),
( 0, 0, 0),
]
print "<table>"
for (cr, cg, cb), (ar, ag, ab) in zip(coeff, ambient):
print "<tr>"
for f in k:
color = (cr * f / 255 + ar, cg * f / 255 + ag, cb * f / 255 + ab)
print "<td style='width: 2em; height: 2em; background: rgb%r'>" % (color,)
print "</td>"
print "</tr>"
print "</table>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment