We used CSS variables to create dark/light themes that can be change at 
runtime by the user. 

First I define a GSS variable: 

@def FONT_COLOR_PRIMARY eval("\"var(--theme-text-primary)\"")

Then I use FONT_COLOR_PRIMARY  in some style in GSS:

.textPrimary {
    color: FONT_COLOR_PRIMARY;
}

The actual value is defined in a CSS file I import into the main HTML page:

:root, :root[theme=light] {
     --theme-text-primary: #333333;
}

:root[theme=dark] {
     --theme-text-primary: #fcfcfc;
}
On Wednesday, November 6, 2024 at 5:29:35 AM UTC-8 David Nouls wrote:

> Reviving an old thread ... 
>
> I need to use CSS variables to override some styling in bootstrap in one 
> of my screens. 
> But it seems that the CSS variable support in closure stylesheets was 
> never finished (and closure stylesheets seems dead)
>
> Should we assume that CssResources and GSS are deprecated and stop using 
> them? Many JS UI components start using CSS variables to allow for 
> customisations.
>
> What are my options? Go for something external to style my GWT 
> application? But then I lose the benefits of the obfuscation and 
> optimisations that are done by GWT.
>
>
> On Monday, September 11, 2017 at 4:49:15 PM UTC+2 [email protected] 
> wrote:
>
>> Thx for the reply. 
>> https://github.com/google/closure-stylesheets/pull/121/commits/7c99519b6726a2bcdb9458d4dc352e8722f50178
>>  
>>
>> It seems there are at least some contribution in this regard :)
>>
>>
>> Am Montag, 11. September 2017 15:29:19 UTC+2 schrieb Jens:
>>>
>>> GWT itself uses a version of Google Closure Stylesheets library 
>>> internally to support CSS 3 features. GWT updates this library from time to 
>>> time to support more CSS 3 features and it looks like CSS variables are not 
>>> yet available in Google Closure Stylesheets: 
>>> https://github.com/google/closure-stylesheets/pull/121
>>>
>>> For now you have to stick with closure stylesheets variables: 
>>> https://github.com/google/closure-stylesheets#variables
>>>
>>> -- J.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit/10c8208c-2929-41c9-9bfa-f9747581a96bn%40googlegroups.com.

Reply via email to