Ask Ubuntu Asked by Garry Pettet on December 13, 2021
Is there a setting that can be read / polled to determine if the global Ubuntu dark mode is enabled or not by the user. I’m writing an app and would like to honour the user’s preference for my UI.
This is not a fancy solution, but you can read the font color css value of e.g. some label. For dark themes this will (probably) be white(ish) and otherwise black. Same should be possible for backgroud-color and so on.
Python example:
tmp = self.label.get_style_context().get_color(Gtk.StateFlags.NORMAL)
textcolor = (tmp.red, tmp.green, tmp.blue, tmp.alpha)
Answered by jl005 on December 13, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP