On Wed, 7 Nov 2018 at 00:48, Yuri Khan via gtk-app-devel-list <
gtk-app-devel-list@gnome.org> wrote:

> Hello everybody,
> I know in the GTK+3 theming engine a theme can define a light variant
> and a dark variant. Is it possible, in an application, to know which
> variant is currently used, and/or specify which widget in the
> application uses which variant?


"Variants" are really only used by applications themselves, i.e. your
application explicitly says that it prefers a dark variant of the current
theme, if it's available. This is opt-in from the application perspective,
though of course themes may not have a dark variant.

User options do not change the theme variant: they change the theme; in
other words, if a user decides to enable a dark theme globally, they will
enable a dark theme, not the dark variant of the current theme.

The only way to respect the GTK theme is to use GTK to render UI elements
according to that theme—using the `gtk_render_*` API. Anything else is, by
and large, impossible unless you literally parse the CSS with your own CSS
parser, determine the colours of every UI element you care about, and then
detect whether those colours are "light" or "dark".


[@] ebassi [@gmail.com]
gtk-app-devel-list mailing list

Reply via email to