add monet theme selector

This commit is contained in:
0xMRTT 2022-08-11 15:00:07 +02:00
parent d5bce25c1e
commit e2c9b17178
No known key found for this signature in database
GPG key ID: AC9E06BF3DECB6FB
2 changed files with 55 additions and 2 deletions

View file

@ -207,9 +207,11 @@ class AdwcustomizerApplication(Adw.Application):
self.reload_variables()
def update_theme_from_monet(self, theme, tone):
def update_theme_from_monet(self, theme, tone, monet_theme):
palettes = theme["palettes"]
monet_theme = monet_theme.get_string()
palette = {}
i = 0
for color in palettes.values():
@ -220,6 +222,56 @@ class AdwcustomizerApplication(Adw.Application):
self.pref_palette_shades["monet"].update_shades(palette)
print(theme)
self.variable = {
"accent_color": theme["schemes"]["light"]["primary"],
"accent_bg_color": theme["schemes"]["light"]["primaryContainer"],
"accent_fg_color": theme["schemes"]["light"]["onPrimaryContainer"],
"destructive_color": theme["schemes"]["light"][""],
"destructive_bg_color": theme["schemes"]["light"][""],
"destructive_fg_color": theme["schemes"]["light"][""],
"success_color": theme["schemes"]["light"][""],
"success_bg_color": theme["schemes"]["light"][""],
"success_fg_color": theme["schemes"]["light"][""],
"warning_color": theme["schemes"]["light"][""],
"warning_bg_color": theme["schemes"]["light"][""],
"warning_fg_color": "rgba(0, 0, 0, 0.8)",
"error_color": theme["schemes"]["light"][""],
"error_bg_color": theme["schemes"]["light"][""],
"error_fg_color": theme["schemes"]["light"][""],
"window_bg_color": theme["schemes"]["light"][""],
"window_fg_color": theme["schemes"]["light"][""],
"view_bg_color": theme["schemes"]["light"][""],
"view_fg_color": theme["schemes"]["light"][""],
"headerbar_bg_color": theme["schemes"]["light"][""],
"headerbar_fg_color": "rgba(0, 0, 0, 0.8)",
"headerbar_border_color": "rgba(0, 0, 0, 0.8)",
"headerbar_backdrop_color": "@window_bg_color",
"headerbar_shade_color": "rgba(0, 0, 0, 0.07)",
"card_bg_color": theme["schemes"]["light"][""],
"card_fg_color": "rgba(0, 0, 0, 0.8)",
"card_shade_color": "rgba(0, 0, 0, 0.07)",
"dialog_bg_color": theme["schemes"]["light"][""],
"dialog_fg_color": "rgba(0, 0, 0, 0.8)",
"popover_bg_color": theme["schemes"]["light"][""],
"popover_fg_color": "rgba(0, 0, 0, 0.8)",
"shade_color": theme["schemes"]["light"][""],
"scrollbar_outline_color": theme["schemes"]["light"][""]
}
def generate_gtk_css(self, app_type):
final_css = ""
for key in self.variables.keys():

View file

@ -91,7 +91,8 @@ class AdwcustomizerMainWindow(Adw.ApplicationWindow):
self.monet_img = Image.open(self.monet_image_file.get_path())
self.monet_theme = themeFromImage(self.monet_img)
self.tone = self.tone_row.get_selected_item()
self.get_application().update_theme_from_monet(self.monet_theme, self.tone)
self.monet_theme = self.monet_theme_row.get_selected_item()
self.get_application().update_theme_from_monet(self.monet_theme, self.tone, self.monet_theme)
def setup_monet_page(self):