def update_color(self, bg_color: str, is_dark: bool):
"""Updates the widget's background color and theme.
:bg_color: string representing the color, or 'None'.
:is_dark: whether the background is dark, see `:h background`.
"""
self.get_settings().props.gtk_application_prefer_dark_theme = is_dark
if bg_color != 'None':
rgba = Gdk.RGBA()
rgba.parse(bg_color)
self.set_color_background(rgba)
else:
GLib.idle_add(self.reset_color)
评论列表
文章目录