aboutsummaryrefslogtreecommitdiffstats
path: root/dist/svg.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-01-03 21:37:24 +0100
committerwout <wout@impinc.co.uk>2013-01-03 21:37:24 +0100
commit99c2d41a80658ff0c0d381ba215ff826b5d99a55 (patch)
tree2ccca39073dcab2e76958832cd5c41c1524bf590 /dist/svg.js
parent6f49a9d4c5ada0b7335c08fbcef623cf32898938 (diff)
downloadsvg.js-99c2d41a80658ff0c0d381ba215ff826b5d99a55.tar.gz
svg.js-99c2d41a80658ff0c0d381ba215ff826b5d99a55.zip
Fix in color parser
Diffstat (limited to 'dist/svg.js')
-rw-r--r--dist/svg.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/dist/svg.js b/dist/svg.js
index 016a568..6170647 100644
--- a/dist/svg.js
+++ b/dist/svg.js
@@ -1,4 +1,4 @@
-/* svg.js v0.1-55-g0da8f1d - svg container element fx event group arrange defs mask gradient doc shape wrap rect ellipse poly path image text nested sugar - svgjs.com/license */
+/* svg.js v0.1-56-g6f49a9d - svg container element fx event group arrange defs mask gradient doc shape wrap rect ellipse poly path image text nested sugar - svgjs.com/license */
(function() {
this.SVG = {
@@ -622,6 +622,7 @@
o.from = this._h2r(o.from || '#000');
// convert hex to rgb and store it for further reference
+
if (typeof o.to !== 'object')
o.to = this._h2r(o.to);
@@ -648,7 +649,13 @@
// private: convert rgb object to hex string
_r2h: function(r) {
- return '#' + (r.r + 256 * r.g + 65536 * r.b).toString(16);
+ return '#' + this._c2h(r.r) + this._c2h(r.g) + this._c2h(r.b);
+ },
+
+ // private: convert component to hex
+ _c2h: function(c) {
+ var h = c.toString(16);
+ return h.length == 1 ? '0' + h : h;
},
// private: force potential 3-based hex to 6-based