Browse Source

Fix in colors

pull/58/head
Florian Mounier 12 years ago
parent
commit
1c98074462
  1. 2
      pygal/__init__.py
  2. 25
      pygal/style.py

2
pygal/__init__.py

@ -21,7 +21,7 @@ Pygal - A python svg graph plotting library
""" """
__version__ = '1.0.0' __version__ = '1.1.0'
import sys import sys
from pygal.config import Config from pygal.config import Config
from pygal.ghost import Ghost from pygal.ghost import Ghost

25
pygal/style.py

@ -194,7 +194,7 @@ TurquoiseStyle = Style(
lighten('#8c6243', 15), '#1b8088')) lighten('#8c6243', 15), '#1b8088'))
GreenLightStyle = Style( LightGreenStyle = Style(
background=lighten('#f3f3f3', 3), background=lighten('#f3f3f3', 3),
plot_background='#fff', plot_background='#fff',
foreground='#333333', foreground='#333333',
@ -209,7 +209,7 @@ GreenLightStyle = Style(
darken('#247fab', 15))) darken('#247fab', 15)))
GreenDarkStyle = Style( DarkGreenStyle = Style(
background=darken('#251e01', 3), background=darken('#251e01', 3),
plot_background=darken('#251e01', 1), plot_background=darken('#251e01', 1),
foreground='rgba(255, 255, 255, 0.9)', foreground='rgba(255, 255, 255, 0.9)',
@ -223,7 +223,7 @@ GreenDarkStyle = Style(
lighten('#fcd202', 25))) lighten('#fcd202', 25)))
GreenBlueDarkStyle = Style( DarkGreenBlueStyle = Style(
background='#000', background='#000',
plot_background=lighten('#000', 8), plot_background=lighten('#000', 8),
foreground='rgba(255, 255, 255, 0.9)', foreground='rgba(255, 255, 255, 0.9)',
@ -262,10 +262,10 @@ styles = {'default': DefaultStyle,
'dark_colorized': DarkColorizedStyle, 'dark_colorized': DarkColorizedStyle,
'light_colorized': LightColorizedStyle, 'light_colorized': LightColorizedStyle,
'turquoise': TurquoiseStyle, 'turquoise': TurquoiseStyle,
'green': GreenLightStyle, 'green': LightGreenStyle,
'dark_green': GreenDarkStyle, 'dark_green': DarkGreenStyle,
'dark_green_blue': GreenBlueDarkStyle, 'dark_green_blue': DarkGreenBlueStyle,
'blue_colorized': BlueStyle} 'blue': BlueStyle}
parametric_styles = {} parametric_styles = {}
@ -275,7 +275,8 @@ for op in ('lighten', 'darken', 'saturate', 'desaturate', 'rotate'):
def get_style_for(op_name): def get_style_for(op_name):
operation = getattr(colors, op_name) operation = getattr(colors, op_name)
def parametric_style(color, step=10, max_=None, **kwargs): def parametric_style(color, step=10, max_=None, base_style=None,
**kwargs):
if max_ is None: if max_ is None:
violency = { violency = {
'darken': 50, 'darken': 50,
@ -296,10 +297,10 @@ for op in ('lighten', 'darken', 'saturate', 'desaturate', 'rotate'):
if base_style is None: if base_style is None:
return Style(colors=colors, **kwargs) return Style(colors=colors, **kwargs)
opts = dict(base_style.__dict__)
base_style.__dict__.update(kwargs) opts.update({'colors': colors})
base_style.colors = colors opts.update(kwargs)
return base_style return Style(**opts)
return parametric_style return parametric_style

Loading…
Cancel
Save