openui5
openui5 copied to clipboard
sap.ui.core.CSSColor Documentation indicates hsla() is supported. But isValid call returns false.
OpenUI5 version: latest
Browser/version (+device/version): Edge(Chromium)
Any other tested browsers/devices(OK/FAIL):
URL (minimal example if possible): https://openui5.hana.ondemand.com/api/sap.ui.core.CSSColor
User/password (if required and possible - do not post any confidential information here):
Steps to reproduce the problem:
- Open documentation. https://sapui5.hana.ondemand.com/#/api/sap.ui.core.CSSColor
- Press F12 and go to console.
- enter in console: sap.ui.core.CSSColor.isValid("hsla(50%,10%,30%,0.5)")
What is the expected result? Console prints true
What happens instead? Console prints false...
Any other information? (attach screenshot if possible)

CSSColor accepts CSS Color Level 3 colors. In level 3, the Hue has to be a pure number (with the implicit unit degree). if you change the first 50% to, say, 90, then isValid will return true.
Well, but even when I look at CSS Color Level 4, I can't make any sense of a percentage hue value (e.g. 50%):
Hue is represented as an angle of the color circle (the rainbow, twisted around into a circle, and with purple added between violet and red).
<hue> = <number> | <angle> | none
Because this value is so often given in degrees, the argument can also be given as a number, which is interpreted as a number of degrees.
So IMO CSSColor behaves a documented (but limited to CSS Color Level 3).