Exemplo n.º 1
0
    for c in colors:
        c2=nearest_color(c,labels,opt=max) #chose the label color with max difference to pantone color
        s='<span title="%s" style="color:%s">%s</span>'%(tooltip(c),c2.hex,c.name)
        t.append(Cell(s,style={'background-color':c.hex}))
    return Table(reshape(t,(0,width)))

# dictionaries of standardized colors

from Goulib.table import Table

path=os.path.dirname(os.path.abspath(__file__))

# http://blog.brunonuttens.com/206-conversion-couleurs-pantone-lab-rvb-hexa-liste-sql-csv/
table=Table(path+'/colors.csv')
table.applyf('hex',lambda x:x.lower())
table=table.groupby('System')

color=Palette() #dict of HTML / matplotlib colors, which seem to be the same
color_lookup=Palette() # reverse color dict indexed by hex
pantone=Palette() #dict of pantone colors

# http://www.w3schools.com/colors/colors_names.asp

for c in table['websafe'].asdict():
    id=c['name'].lower()
    hex=c['hex']
    c=Color(hex,name=id,illuminant='D65')
    color[id]=c
    color_lookup[c.hex]=c

for c in table['Pantone'].asdict():
Exemplo n.º 2
0
        s = '<span title="%s" style="color:%s">%s</span>' % (tooltip(c),
                                                             c2.hex, c.name)
        t.append(Cell(s, style={'background-color': c.hex}))
    return Table(reshape(t, (0, width)))


# dictionaries of standardized colors

from Goulib.table import Table

path = os.path.dirname(os.path.abspath(__file__))

# http://blog.brunonuttens.com/206-conversion-couleurs-pantone-lab-rvb-hexa-liste-sql-csv/
table = Table(path + '/colors.csv')
table.applyf('hex', lambda x: x.lower())
table = table.groupby('System')

color = Palette()  #dict of HTML / matplotlib colors, which seem to be the same
color_lookup = Palette()  # reverse color dict indexed by hex
pantone = Palette()  #dict of pantone colors

# http://www.w3schools.com/colors/colors_names.asp

for c in table['websafe'].asdict():
    id = c['name'].lower()
    hex = c['hex']
    c = Color(hex, name=id, illuminant='D65')
    color[id] = c
    color_lookup[c.hex] = c

for c in table['Pantone'].asdict():