As can be seen, the input was a nice hex color, but the output is not exactly compatible with perspective (although the output seems consistent with the functions name).
So how do I get back to a perspective useable color after using brighter or darker?
Or better still how can I do HSL manipulations in expression bindings?
I never liked those two functions. Without arguments they’re utterly useless imo.
In Perspective you could either script it (search for python functions to change colour values) or you could use a style.filter = brightness(0.5) for example. Preferable not to use scripting as it adds more load to the gateway. More clients = more load = less scalable
I don’t particularly like those functions either, but I am looking for a way to apply HSL transformations in bindings (that will ultimately be controlled via some bools)
They seemed as close as possible to what I was looking for.
brighter and darker date back to Vision, and, for complex reasons, return Java Color objects, which won’t be immediately useful to you. You might be able to use the output you get from toInt(brighter("color")) as a useful CSS output color?
I would still recommend filter: brightness though.
A usable colour is literally just the text string hsl(…) so you just return the string itself. To make it easier though you might use a variable to store the h s and l and then combine them together to make the string. Then just manip the l
The colors will be statically defined on each object, and I want to do HSL manipulations based on other booleans on the same objects. The resultant colors will be injected into a pre-defined gradient definition on the same object.
The hsl color isn’t making it to the gradient. So it looks like I can’t even do that. I think I might be stuck with manually predefining hex colors.
Yes … a simple SVG circle that I am filling with a radial gradient. By binding to the stopColor (and manipulating from other Custom properties) I can simulate various animation behaviors in a simple manner.
I wanted to experiment with the lighter() and darker() expressions in perspective. In order to do so, you have to convert to hex then to string. This works, but I agree that it is not super useful.