Elm.Native.Color = {}; Elm.Native.Color.make = function(elm) { elm.Native = elm.Native || {}; elm.Native.Color = elm.Native.Color || {}; if (elm.Native.Color.values) return elm.Native.Color.values; var Utils = Elm.Native.Utils.make(elm); function toCss(c) { var format = ''; var colors = ''; if (c.ctor === 'RGBA') { format = 'rgb'; colors = c._0 + ', ' + c._1 + ', ' + c._2; } else { format = 'hsl'; colors = (c._0 * 180 / Math.PI) + ', ' + (c._1 * 100) + '%, ' + (c._2 * 100) + '%'; } if (c._3 === 1) { return format + '(' + colors + ')'; } else { return format + 'a(' + colors + ', ' + c._3 + ')'; } } return elm.Native.Color.values = { toCss:toCss }; };