Thanks,

I always gravitate towards following specifications, and it looks like any
standards implementation will require using `var()`. This can be beneficial
in many places in css since it composes with anything else.
However, from what I understand, JavaFX already doesn't follow the
specifications because it allows to omit `var()` in property values:
`-fx-text-fill: -my-color` whereas css requires `-fx-text-fill:
var(-my-color)`.

Is it worth implementing `var()` anyway?

On Thu, Oct 8, 2026 at 11:41 AM John Hendrikx <[email protected]>
wrote:

>
> On 07/10/2026 17:00, Nir Lisker wrote:
> > JavaFX has no way to derive rgba colors from color constants, but it can
> > derive brightness changes. For example:
> >
> > .root {
> >     -primary: #d4af37; // rgb:  212, 175, 55
> >     -dim: derive(-primary, -25%); // brightness change
> >     -wash: rgba(212, 175, 55, 0.14); // works by retyping the numbers
> >     -wash2: rgba(-primary, 0.25); // fails: Expected '<number>' or
> > '<percentage>' while parsing '-wash2'
> > }
>
> `derive` is not standard CSS, so we could do anything we want there.
>
> Variables without using `var()` are not standard CSS.
>
> `rgba` is standard CSS, and it doesn't support changing the transparency
> in that way (only SCSS/LESS do it that way and was rejected for standard
> CSS).
>
> Options I think there that are available:
>
> - Implement `color-mix`
> - Implement the new relative color syntax `rgb(from var(--primary) r g b
> / 0.25)` -- nasty I think, extracting components etc.., probably
> requires a new parser
> - Extend `derive` with a 3rd parameter
>
> Alternatively, you can just use SCSS in JavaFX:
> https://github.com/int4-org/SCSS
>
> --John
>
> > I haven't done much work in the CSS parser area. Can this functionality
> be
> > implemented in a CSS spec-compliant way?

Reply via email to