Skip to content

Commit 3f16b34

Browse files
committed
Accept string as color input
1 parent 5c70d37 commit 3f16b34

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/icon.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ goog.require('ol.Feature');
22
goog.require('ol.Map');
33
goog.require('ol.Overlay');
44
goog.require('ol.View');
5-
goog.require('ol.color');
65
goog.require('ol.geom.Point');
76
goog.require('ol.layer.Tile');
87
goog.require('ol.layer.Vector');
@@ -24,7 +23,7 @@ var iconStyle = new ol.style.Style({
2423
anchor: [0.5, 46],
2524
anchorXUnits: 'fraction',
2625
anchorYUnits: 'pixels',
27-
color: ol.color.asArray('#8959A8'),
26+
color: '#8959A8',
2827
opacity: 0.75,
2928
src: 'data/icon.png'
3029
}))

externs/olx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6040,7 +6040,7 @@ olx.style.FillOptions.prototype.color;
60406040
* anchorOrigin: (ol.style.IconOrigin|undefined),
60416041
* anchorXUnits: (ol.style.IconAnchorUnits|undefined),
60426042
* anchorYUnits: (ol.style.IconAnchorUnits|undefined),
6043-
* color: (ol.Color|undefined),
6043+
* color: (ol.Color|string|undefined),
60446044
* crossOrigin: (null|string|undefined),
60456045
* img: (Image|HTMLCanvasElement|undefined),
60466046
* offset: (Array.<number>|undefined),
@@ -6097,7 +6097,7 @@ olx.style.IconOptions.prototype.anchorYUnits;
60976097

60986098
/**
60996099
* Color to tint the icon. If not specified, the icon will be left as is.
6100-
* @type {ol.Color|undefined}
6100+
* @type {ol.Color|string|undefined}
61016101
* @api
61026102
*/
61036103
olx.style.IconOptions.prototype.color;

src/ol/style/iconstyle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ ol.style.Icon = function(opt_options) {
129129
/**
130130
* @type {ol.Color}
131131
*/
132-
var color = options.color !== undefined ? options.color : null;
132+
var color = options.color !== undefined ? ol.color.asArray(options.color) :
133+
null;
133134

134135
/**
135136
* @private

0 commit comments

Comments
 (0)