From 3f16b340fc8af4a34ce611ed7c58ee72b6400e41 Mon Sep 17 00:00:00 2001 From: Alexandre Brault Date: Fri, 4 Dec 2015 17:54:37 -0500 Subject: [PATCH] Accept string as color input --- examples/icon.js | 3 +-- externs/olx.js | 4 ++-- src/ol/style/iconstyle.js | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/icon.js b/examples/icon.js index 0e64c84c30..961c0170dc 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -2,7 +2,6 @@ goog.require('ol.Feature'); goog.require('ol.Map'); goog.require('ol.Overlay'); goog.require('ol.View'); -goog.require('ol.color'); goog.require('ol.geom.Point'); goog.require('ol.layer.Tile'); goog.require('ol.layer.Vector'); @@ -24,7 +23,7 @@ var iconStyle = new ol.style.Style({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', - color: ol.color.asArray('#8959A8'), + color: '#8959A8', opacity: 0.75, src: 'data/icon.png' })) diff --git a/externs/olx.js b/externs/olx.js index 24e28a1d9a..bb18a747f8 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -6040,7 +6040,7 @@ olx.style.FillOptions.prototype.color; * anchorOrigin: (ol.style.IconOrigin|undefined), * anchorXUnits: (ol.style.IconAnchorUnits|undefined), * anchorYUnits: (ol.style.IconAnchorUnits|undefined), - * color: (ol.Color|undefined), + * color: (ol.Color|string|undefined), * crossOrigin: (null|string|undefined), * img: (Image|HTMLCanvasElement|undefined), * offset: (Array.|undefined), @@ -6097,7 +6097,7 @@ olx.style.IconOptions.prototype.anchorYUnits; /** * Color to tint the icon. If not specified, the icon will be left as is. - * @type {ol.Color|undefined} + * @type {ol.Color|string|undefined} * @api */ olx.style.IconOptions.prototype.color; diff --git a/src/ol/style/iconstyle.js b/src/ol/style/iconstyle.js index 73ac945c33..f8d99ebc7b 100644 --- a/src/ol/style/iconstyle.js +++ b/src/ol/style/iconstyle.js @@ -129,7 +129,8 @@ ol.style.Icon = function(opt_options) { /** * @type {ol.Color} */ - var color = options.color !== undefined ? options.color : null; + var color = options.color !== undefined ? ol.color.asArray(options.color) : + null; /** * @private