helloyou2012 / canviz

Automatically exported from code.google.com/p/canviz
0 stars 0 forks source link

Color schemes should use hex not integer colors to save space #42

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The color scheme files express colors in integer RGB format:

aliceblue:[240,248,255]

But if we convert the colors to hex RGB format we can save up to 5 bytes per 
color:

aliceblue:'f0f8ff'

I originally used RGB format because that's how it's expressed in the Graphviz 
source and I was 
manually munging that file in a text editor to produce the file that is now 
x11colors.js. But since 
the color scheme files are now generated automatically (see issue #1 and issue 
#2) it's trivial to 
convert the data from integer to hex.

Original issue reported on code.google.com by ryandesi...@gmail.com on 27 Dec 2008 at 12:09

GoogleCodeExporter commented 8 years ago
r242: I moved the hex color parsing out of parseColor() into its own method 
parseHexColor() so it can be reused 
for handling color scheme data.

Original comment by ryandesi...@gmail.com on 27 Dec 2008 at 12:11

GoogleCodeExporter commented 8 years ago
r243: Fixed: color scheme files now use hex color data instead of integer.

x11colors.js was 15347 bytes, is now 12749 bytes (17% smaller)

brewercolors.js was 30468 bytes, is now 23359 bytes (23% smaller)

Original comment by ryandesi...@gmail.com on 27 Dec 2008 at 1:44

GoogleCodeExporter commented 8 years ago
r244: Fixed fallback colors that I broke in r243.

Original comment by ryandesi...@gmail.com on 27 Dec 2008 at 2:16