Merge pull request #6124 from marcjansen/more-digits

Allow up to 16 decimals for alpha channel when parsing rgba strings to colors
This commit is contained in:
Marc Jansen
2016-11-14 10:33:42 +01:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ ol.color.RGB_COLOR_RE_ =
* @private
*/
ol.color.RGBA_COLOR_RE_ =
/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,10})\)$/i;
/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,16})\)$/i;
/**

View File

@@ -81,6 +81,8 @@ describe('ol.color', function() {
it('can parse rgba colors', function() {
expect(ol.color.fromString('rgba(255, 255, 0, 0.1)')).to.eql(
[255, 255, 0, 0.1]);
expect(ol.color.fromString('rgba(255, 255, 0, 0.3333333333333333)')).to.eql(
[255, 255, 0, 0.3333333333333333]);
});
it('caches parsed values', function() {