diff --git a/src/ol/style/expressions.js b/src/ol/style/expressions.js index cb13025692..ff29c14dfd 100644 --- a/src/ol/style/expressions.js +++ b/src/ol/style/expressions.js @@ -606,6 +606,10 @@ function getEqualOperator(operator) { ); } + // Since it's not possible to have color types here, we can leave it out + // This fixes issues in case the value type is ambiguously detected as a color (e.g. the string 'red') + type = type ^ ValueTypes.COLOR; + return `(${expressionToGlsl( context, args[0], diff --git a/test/browser/spec/ol/style/expressions.test.js b/test/browser/spec/ol/style/expressions.test.js index 63878458b9..caabe63156 100644 --- a/test/browser/spec/ol/style/expressions.test.js +++ b/test/browser/spec/ol/style/expressions.test.js @@ -250,6 +250,9 @@ describe('ol.style.expressions', function () { expect(expressionToGlsl(context, ['==', 10, ['get', 'attr4']])).to.eql( '(10.0 == a_attr4)' ); + expect(expressionToGlsl(context, ['==', 'red', ['get', 'attr4']])).to.eql( + `(${stringToGlsl(context, 'red')} == a_attr4)` + ); expect(expressionToGlsl(context, ['!=', 10, ['get', 'attr4']])).to.eql( '(10.0 != a_attr4)' );