diff --git a/libraries/Native/Color.js b/libraries/Native/Color.js index 8c44c98..80aeec0 100644 --- a/libraries/Native/Color.js +++ b/libraries/Native/Color.js @@ -6,6 +6,12 @@ Elm.Native.Color.make = function(elm) { var Utils = Elm.Native.Utils.make(elm); + function toCss(c) { + return (c._3 === 1) + ? ('rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')') + : ('rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')'); + } + function complement(rgb) { var hsv = toHSV(rgb); hsv.hue = (hsv.hue + 180) % 360; @@ -63,7 +69,8 @@ Elm.Native.Color.make = function(elm) { return elm.Native.Color.values = { hsva:F4(hsva), hsv:F3(hsv), - complement:complement + complement:complement, + toCss:toCss }; -}; \ No newline at end of file +}; diff --git a/libraries/Native/Text.js b/libraries/Native/Text.js index f777a97..ca0bf22 100644 --- a/libraries/Native/Text.js +++ b/libraries/Native/Text.js @@ -4,6 +4,7 @@ Elm.Native.Text.make = function(elm) { elm.Native.Text = elm.Native.Text || {}; if (elm.Native.Text.values) return elm.Native.Text.values; + var Color = Elm.Native.Color.make(elm); var Element = Elm.Graphics.Element.make(elm); var List = Elm.Native.List.make(elm); var Utils = Elm.Native.Utils.make(elm); @@ -69,16 +70,10 @@ Elm.Native.Text.make = function(elm) { ctor === 'Over' ? 'overline' : 'line-through'; return 'text-decoration:' + decoration + ';'; } - function toColor(c) { - var color = (c._3 === 1) - ? ('rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')') - : ('rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')'); - return 'color:' + color + ';'; - } // setting styles of Text function style(style, text) { - var newText = '