Created
November 4, 2012 23:52
-
-
Save sammyoos/4014407 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<span style="background: #0000ff"> 1 </span> | |
<span style="background: #000df1"> 2 </span> | |
<span style="background: #001ae3"> 3 </span> | |
<span style="background: #0027d5"> 4 </span> | |
<span style="background: #0034c7"> 5 </span> | |
<span style="background: #0041b9"> 6 </span> | |
<span style="background: #004eab"> 7 </span> | |
<span style="background: #005b9d"> 8 </span> | |
<span style="background: #00688f"> 9 </span> | |
<span style="background: #007581"> 10 </span> | |
<span style="background: #008273"> 11 </span> | |
<span style="background: #008f65"> 12 </span> | |
<span style="background: #009c57"> 13 </span> | |
<span style="background: #00a949"> 14 </span> | |
<span style="background: #00b63b"> 15 </span> | |
<span style="background: #00c32d"> 16 </span> | |
<span style="background: #00d01f"> 17 </span> | |
<span style="background: #00dd11"> 18 </span> | |
<span style="background: #00ea03"> 19 </span> | |
<span style="background: #00ff00"> 20 </span> <br/> | |
<span style="background: #ffffff"> 1 </span> | |
<span style="background: #ececec"> 2 </span> | |
<span style="background: #d9d9d9"> 3 </span> | |
<span style="background: #c6c6c6"> 4 </span> | |
<span style="background: #b3b3b3"> 5 </span> | |
<span style="background: #a0a0a0"> 6 </span> | |
<span style="background: #8d8d8d"> 7 </span> | |
<span style="background: #7a7a7a"> 8 </span> | |
<span style="background: #676767"> 9 </span> | |
<span style="background: #545454"> 10 </span> | |
<span style="background: #414141"> 11 </span> | |
<span style="background: #2e2e2e"> 12 </span> | |
<span style="background: #1b1b1b"> 13 </span> | |
<span style="background: #080808"> 14 </span> | |
<span style="background: #000000"> 15 </span> <br/> | |
<span style="background: #aa08c3"> 1 </span> | |
<span style="background: #9716b0"> 2 </span> | |
<span style="background: #84249d"> 3 </span> | |
<span style="background: #71328a"> 4 </span> | |
<span style="background: #5e4077"> 5 </span> | |
<span style="background: #4b4e64"> 6 </span> | |
<span style="background: #385c51"> 7 </span> | |
<span style="background: #256a3e"> 8 </span> | |
<span style="background: #12782b"> 9 </span> | |
<span style="background: #03881c"> 10 </span> <br/> | |
<span style="background: #a0a080"> 1 </span> | |
<span style="background: #a8a860"> 2 </span> | |
<span style="background: #b0b040"> 3 </span> | |
<span style="background: #b8b820"> 4 </span> | |
<span style="background: #c0c000"> 5 </span> <br/> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# to run: python fader.py > fader.html | |
# then: firefox fader.html | |
outputFormat = '<span style="background: #%02x%02x%02x"> %i </span>' | |
def fader ( steps, c1, c2 ): | |
inc = map( lambda i:(c2[i]-c1[i])/( steps-1 ), range(0,3)) | |
for i in range(0,steps-1): | |
print outputFormat % ( | |
c1[0] + i*inc[0], | |
c1[1] + i*inc[1], | |
c1[2] + i*inc[2], | |
i+1 ) | |
print outputFormat % ( c2[0], c2[1], c2[2], steps ), '<br/>' | |
fader( steps = 20, | |
c1 = [ 0x00, 0x00, 0xFF ], | |
c2 = [ 0x00, 0xFF, 0x00 ] ) | |
fader( steps = 15, | |
c1 = [ 0xFF, 0xFF, 0xFF ], | |
c2 = [ 0x00, 0x00, 0x00 ] ) | |
fader( steps = 10, | |
c1 = [ 0xAA, 0x08, 0xC3 ], | |
c2 = [ 0x03, 0x88, 0x1C ] ) | |
fader( steps = 5, | |
c1 = [ 0xA0, 0xA0, 0x80 ], | |
c2 = [ 0xC0, 0xC0, 0x00 ] ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment