Email or username:

Password:

Forgot your password?
Alice :neocat_trans_cute:‮

So, CSS variable support has landed in GTK, and libadwaita now uses it. Note that it's super basic for now, it's just replacements for the old @colors. There will be more drastic changes in 2.0, but for now I need to keep backwards compatibility.

So, apps can now override them per widget, like on the screenshot (well, once the sdk updates, anyway)

And because why not, there are a few changes that variables enabled:

.error, .warning and .success style classes now also change the accent color respectively. For example, this means that a selectable label with .error style class will have a red selection as well, instead of blue.

The .opaque style class for buttons has been deprecated - instead, apps can simply use .suggested-action and override the accent color on it (or add .error/.warning/.success - that works too). This will also change the focus ring, and similarly, .destructive-action buttons have red focus rings now.

Apps are encouraged to migrate, but the old colors will keep working until 2.0. For example, @accent_color can be replaced with var(--accent-color) and so on, note the dashes in the names instead of underscores. See the docs for more info: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/css-variables.html

Screenshot of 2 switches in libadwaita demo, with one of them being purple instead of blue. Below is inspector, showing CSS tab, with the following css:

.alternate-row {
  --accent-bg-color: var(--purple-3);
}
1 comment
Sergey Bugaev

@alice I'm guessing there's no public API to get a color variable's value for a widget programmatically, is there? Basically I'd want something like the existing Widget::get_color, but with a name argument.

Go Up