Browse Source

Optimize color list

pull/242/head
Florian Mounier 10 years ago
parent
commit
16e834d063
  1. 10
      pygal/style.py

10
pygal/style.py

@ -87,7 +87,7 @@ class Style(object):
raise ValueError( raise ValueError(
'stroke_dasharray not in proper form: tuple(int, int)') 'stroke_dasharray not in proper form: tuple(int, int)')
def get_colors(self, prefix): def get_colors(self, prefix, len_):
"""Get the css color list""" """Get the css color list"""
def color(tupl): def color(tupl):
@ -98,8 +98,12 @@ class Style(object):
' fill: {1};\n' ' fill: {1};\n'
'}}\n') % (prefix, prefix)).format(*tupl) '}}\n') % (prefix, prefix)).format(*tupl)
return '\n'.join(map(color, enumerate( if len(self.colors) < len_:
cycle_fill(self.colors, max(len(self.colors), 16))))) colors = cycle_fill(self.colors, len_)
else:
colors = self.colors[:len_]
return '\n'.join(map(color, enumerate(colors)))
def to_dict(self): def to_dict(self):
config = {} config = {}

Loading…
Cancel
Save