Add ol.Color.parse

This commit is contained in:
Tom Payne
2013-10-02 14:54:32 +02:00
parent a60a03149e
commit 3d072a1af8

View File

@@ -60,3 +60,13 @@ ol.Color.equals = function(color1, color2) {
color1.b == color2.b &&
color1.a == color2.a);
};
/**
* @param {string} s String.
* @return {ol.Color} Color.
*/
ol.Color.parse = function(s) {
var rgb = goog.color.hexToRgb(goog.color.parse(s).hex);
return new ol.Color(rgb[0], rgb[1], rgb[2], 1);
};