diff --git a/pygal/config.py b/pygal/config.py index 9a6d2a3..8b11a93 100644 --- a/pygal/config.py +++ b/pygal/config.py @@ -21,6 +21,8 @@ from copy import deepcopy from pygal import formatters +from pygal.css import CSS_GRAPH +from pygal.css import CSS_STYLE from pygal.interpolate import INTERPOLATIONS from pygal.style import DefaultStyle, Style @@ -37,7 +39,7 @@ class Key(object): a category, a documentation, an optional longer documentatation and an optional subtype for list style option. - Most of these informations are used in cabaret to auto generate + Most of these information are used in cabaret to auto generate forms representing these options. """ @@ -240,7 +242,7 @@ class Config(CommonConfig): DefaultStyle, Style, "Style", "Style holding values injected in css") css = Key( - ('file://style.css', 'file://graph.css'), list, "Style", + ('template://{}'.format(CSS_STYLE), 'template://{}'.format(CSS_GRAPH)), list, "Style", "List of css file", "It can be any uri from file:///tmp/style.css to //domain/style.css", str) diff --git a/pygal/svg.py b/pygal/svg.py index d72c1e6..ccb940c 100644 --- a/pygal/svg.py +++ b/pygal/svg.py @@ -34,6 +34,8 @@ from pygal.util import ( coord_abs_project, coord_diff, coord_dual, coord_format, coord_project, minify_css, template) +from pygal.css import CSS_BASE + nearly_2pi = 2 * pi - .00001 @@ -92,7 +94,7 @@ class Svg(object): colors = self.graph.style.get_colors(self.id, self.graph._order) strokes = self.get_strokes() all_css = [] - auto_css = ['file://base.css'] + auto_css = ['template://{}'.format(CSS_BASE)] if self.graph.style._google_fonts: auto_css.append( @@ -104,7 +106,19 @@ class Svg(object): css_text = None if css.startswith('inline:'): css_text = css[len('inline:'):] + + elif css.startswith('template://'): + css = css[len('template://'):] + css_text = template( + css, + style=self.graph.style, + colors=colors, + strokes=strokes, + id=self.id + ) + elif css.startswith('file://'): + css = css[len('file://'):] if not os.path.exists(css):