summaryrefslogtreecommitdiffstats
path: root/src/element.js
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2013-03-06 19:43:17 +0000
committerwout <wout@impinc.co.uk>2013-03-06 19:43:17 +0000
commit5e3ff072994d3d9b224c62d71ca1331951249bac (patch)
tree9bb8b5af1ca4372fcf0c03b0444530fefee20735 /src/element.js
parent6a8a3fee7dbfc9a9f4a36dc5877f955f5743a4ac (diff)
downloadsvg.js-5e3ff072994d3d9b224c62d71ca1331951249bac.tar.gz
svg.js-5e3ff072994d3d9b224c62d71ca1331951249bac.zip
Reworked color management
Diffstat (limited to 'src/element.js')
-rw-r--r--src/element.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/element.js b/src/element.js
index 63f8c31..e11f650 100644
--- a/src/element.js
+++ b/src/element.js
@@ -160,6 +160,10 @@ SVG.extend(SVG.Element, {
if (a == 'stroke-width')
this.attr('stroke', parseFloat(v) > 0 ? this.attrs.stroke : null)
+ /* ensure hex color */
+ if (SVG.Color.test(v) || SVG.Color.isRgb(v) || SVG.Color.isHsb(v))
+ v = new SVG.Color(v).toHex()
+
/* set give attribute on node */
n != null ?
this.node.setAttributeNS(n, a, v) :