diff --git a/.git_hooks b/.git_hooks
deleted file mode 160000
index 20900882..00000000
--- a/.git_hooks
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 209008820b1fdb24ddf7bab3b419b68f8d9dba9d
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index a1c8f765..00000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule ".git_hooks"]
- path = .git_hooks
- url = git://github.com/Kozea/.git_hooks.git
diff --git a/pygal/config.py b/pygal/config.py
index 9a6d2a3e..8b11a939 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/css/__init__.py b/pygal/css/__init__.py
new file mode 100644
index 00000000..fa709d18
--- /dev/null
+++ b/pygal/css/__init__.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# This file is part of pygal
+#
+# A python svg graph plotting library
+# Copyright © 2012-2018 Kozea
+#
+# This library is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with pygal. If not, see .
+
+"""CSS package containing all needed styles"""
+
+from pygal.css.base import CSS as CSS_BASE
+from pygal.css.graph import CSS as CSS_GRAPH
+from pygal.css.style import CSS as CSS_STYLE
+
+__all__ = ('CSS_BASE', 'CSS_GRAPH', 'CSS_STYLE',)
diff --git a/pygal/css/base.css b/pygal/css/base.py
similarity index 70%
rename from pygal/css/base.css
rename to pygal/css/base.py
index 01f5d5b2..6b7c01ff 100644
--- a/pygal/css/base.css
+++ b/pygal/css/base.py
@@ -1,4 +1,25 @@
-/*
+# -*- coding: utf-8 -*-
+# This file is part of pygal
+#
+# A python svg graph plotting library
+# Copyright © 2012-2018 Kozea
+#
+# This library is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with pygal. If not, see .
+
+"""Base styles"""
+
+CSS = """/*
* This file is part of pygal
*
* A python svg graph plotting library
@@ -67,3 +88,4 @@
font-family: {{ style.no_data_font_family }};
font-size: {{ style.no_data_font_size }}px;
}
+"""
diff --git a/pygal/css/graph.css b/pygal/css/graph.py
similarity index 77%
rename from pygal/css/graph.css
rename to pygal/css/graph.py
index a638fb73..08c62057 100644
--- a/pygal/css/graph.css
+++ b/pygal/css/graph.py
@@ -1,4 +1,25 @@
-/*
+# -*- coding: utf-8 -*-
+# This file is part of pygal
+#
+# A python svg graph plotting library
+# Copyright © 2012-2018 Kozea
+#
+# This library is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with pygal. If not, see .
+
+"""Graph styles"""
+
+CSS = """/*
* This file is part of pygal
*
* A python svg graph plotting library
@@ -150,3 +171,4 @@
stroke: {{ style.background }};
stroke-width: 2px;
}
+"""
diff --git a/pygal/css/style.css b/pygal/css/style.py
similarity index 81%
rename from pygal/css/style.css
rename to pygal/css/style.py
index cd01f06f..57d78eca 100644
--- a/pygal/css/style.css
+++ b/pygal/css/style.py
@@ -1,4 +1,25 @@
-/*
+# -*- coding: utf-8 -*-
+# This file is part of pygal
+#
+# A python svg graph plotting library
+# Copyright © 2012-2018 Kozea
+#
+# This library is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with pygal. If not, see .
+
+"""Styles"""
+
+CSS = """/*
* This file is part of pygal
*
* A python svg graph plotting library
@@ -172,3 +193,4 @@
{{ colors }}
{{ strokes }}
+"""
diff --git a/pygal/svg.py b/pygal/svg.py
index d72c1e68..ccb940c9 100644
--- a/pygal/svg.py
+++ b/pygal/svg.py
@@ -34,6 +34,8 @@
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 @@ def add_styles(self):
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 @@ def add_styles(self):
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):