The better approach, IMHO, is to use a CSS preprocessor like SCSS/SASS which providers darken() and lighten() functions that operate on colours. Plus they provide nested rules and variables. I used SCSS in a recent project and it worked really well.
The problem with this is that you can't adapt for desktop theme changes
as you see on Linux e.g. Ubuntu you need to derive from orange, on
fedora it might be another color.
You can only collect those informations at runtime, so at least allowing
people to contribute colors they are calculating at start up is needed.
Do you think the approach I used in my github project could be added to
the CSS engine?
Am 11.11.12 13:46, schrieb Brian de Alwis:
> The better approach, IMHO, is to use a CSS preprocessor like SCSS/SASS
> which providers darken() and lighten() functions that operate on
> colours. Plus they provide nested rules and variables. I used SCSS in
> a recent project and it worked really well.
CSS 2.1 has a way to expose system colours to CSS using specific named constants, and I'm sure I prototyped a way to expose those from the SWT OS-specified colours. But I can't find my patch nor the message about it, though it was pretty straightforward to implement.
Unfortunately CSS 2.1 system colours won't be adequate to implement your exampe code -- your example uses SWT.COLOR_TITLE_BACKGROUND to generate a gradient. CSS 2.1 doesn't have a concept of functions that operate on data, and even if we could find a CSS3 implementation, there don't seem to be any such functions there either. I'm loathe to extend our CSS engine to be non-compliant, especially since the underlying Batik implementation doesn't seem to be maintained.