Open kookma opened 3 years ago
Hi @kookma can you give an example that doesn't work?
This works for me:
<<contrastcolour target:"hsl(0, 100%, 50%)" colourA:red colourB:red>>
The underlying JS call works too:
> $tw.utils.parseCSSColor("hsl(0, 100%, 50%)")
[255, 0, 0, 1]
The colour parser we use is quite old (https://github.com/deanm/css-color-parser-js), so I imagine you're using some new fangled colour format that's been introduced recently?
Hi @Jermolene My mistake! Sorry I passed a wikified hsl function as below
\define hslcolor() hsl($(hue)$, $(saturation)$%, $(lightness)$%)
\define newcolor() <<contrastcolour target:$(colour)$ ....
.
.
<$wikify name=color text=<
Hi @Jermolene - it seems contrastcolour does not appreciate the alpha value. Check this script in
<<contrastcolour target:"hsla(0, 100%, 50%, 0.2)" colourA:black colourB:white>>
This should return black, but it returns white! Changing the alpha value do not change the result.
See : https://www.w3schools.com/html/html_colors_hsl.asp This works fine!
Hi @kookma that's what I meant about newer features: I believe that alpha channels in HSL colours in that format are relatively new, and therefore not understood by the library we're using.
I'd like to move to a newer colour parsing library, and have an even more exacting requirement: that it should be able to cope with new "wide colors" specified in the P9 colour space. This gives access to the colours offered by HDR displays that are not part of the usual RGB space.
Thank you Jeremy! Should I close this issue?
There is a new library: https://vis4.net/chromajs/ which IMO would be worth to check out
Describe the bug passing color to contrastcolour using hsl or hsla function does not work
TiddlyWiki Configuration (please complete the following information):
Desktop (please complete the following information):