From 1c98074462ff02f4175a4942fc15f5e4c4cb3b27 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Tue, 25 Jun 2013 16:11:10 +0200 Subject: [PATCH] Fix in colors --- pygal/__init__.py | 2 +- pygal/style.py | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/pygal/__init__.py b/pygal/__init__.py index 965a20a..3154b2e 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -21,7 +21,7 @@ Pygal - A python svg graph plotting library """ -__version__ = '1.0.0' +__version__ = '1.1.0' import sys from pygal.config import Config from pygal.ghost import Ghost diff --git a/pygal/style.py b/pygal/style.py index a56d460..1e7055a 100644 --- a/pygal/style.py +++ b/pygal/style.py @@ -194,7 +194,7 @@ TurquoiseStyle = Style( lighten('#8c6243', 15), '#1b8088')) -GreenLightStyle = Style( +LightGreenStyle = Style( background=lighten('#f3f3f3', 3), plot_background='#fff', foreground='#333333', @@ -209,7 +209,7 @@ GreenLightStyle = Style( darken('#247fab', 15))) -GreenDarkStyle = Style( +DarkGreenStyle = Style( background=darken('#251e01', 3), plot_background=darken('#251e01', 1), foreground='rgba(255, 255, 255, 0.9)', @@ -223,7 +223,7 @@ GreenDarkStyle = Style( lighten('#fcd202', 25))) -GreenBlueDarkStyle = Style( +DarkGreenBlueStyle = Style( background='#000', plot_background=lighten('#000', 8), foreground='rgba(255, 255, 255, 0.9)', @@ -262,10 +262,10 @@ styles = {'default': DefaultStyle, 'dark_colorized': DarkColorizedStyle, 'light_colorized': LightColorizedStyle, 'turquoise': TurquoiseStyle, - 'green': GreenLightStyle, - 'dark_green': GreenDarkStyle, - 'dark_green_blue': GreenBlueDarkStyle, - 'blue_colorized': BlueStyle} + 'green': LightGreenStyle, + 'dark_green': DarkGreenStyle, + 'dark_green_blue': DarkGreenBlueStyle, + 'blue': BlueStyle} parametric_styles = {} @@ -275,7 +275,8 @@ for op in ('lighten', 'darken', 'saturate', 'desaturate', 'rotate'): def get_style_for(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: violency = { 'darken': 50, @@ -296,10 +297,10 @@ for op in ('lighten', 'darken', 'saturate', 'desaturate', 'rotate'): if base_style is None: return Style(colors=colors, **kwargs) - - base_style.__dict__.update(kwargs) - base_style.colors = colors - return base_style + opts = dict(base_style.__dict__) + opts.update({'colors': colors}) + opts.update(kwargs) + return Style(**opts) return parametric_style