mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-06-28 07:29:56 +00:00
feat: Improve Monet palette generation
Use less saturated colors more similar to original M3, make all objects distinguishable and fix various issues such as black card and headerbar outlines
This commit is contained in:
parent
ed50f2cdbf
commit
4bc2cb408f
|
@ -65,50 +65,7 @@ class PresetUtils:
|
||||||
if not monet_palette:
|
if not monet_palette:
|
||||||
raise AttributeError("Property 'monet_palette' missing")
|
raise AttributeError("Property 'monet_palette' missing")
|
||||||
|
|
||||||
if theme == "dark":
|
if theme == "light":
|
||||||
dark_theme = monet_palette["schemes"]["dark"]
|
|
||||||
variable = {
|
|
||||||
"accent_color": argb_to_color_code(dark_theme.primary),
|
|
||||||
"accent_bg_color": argb_to_color_code(dark_theme.primaryContainer),
|
|
||||||
"accent_fg_color": argb_to_color_code(dark_theme.onPrimaryContainer),
|
|
||||||
"destructive_color": argb_to_color_code(dark_theme.error),
|
|
||||||
"destructive_bg_color": argb_to_color_code(dark_theme.errorContainer),
|
|
||||||
"destructive_fg_color": argb_to_color_code(
|
|
||||||
dark_theme.onErrorContainer
|
|
||||||
),
|
|
||||||
"success_color": argb_to_color_code(dark_theme.tertiary),
|
|
||||||
"success_bg_color": argb_to_color_code(dark_theme.onTertiary),
|
|
||||||
"success_fg_color": argb_to_color_code(dark_theme.onTertiaryContainer),
|
|
||||||
"warning_color": argb_to_color_code(dark_theme.secondary),
|
|
||||||
"warning_bg_color": argb_to_color_code(dark_theme.onSecondary),
|
|
||||||
"warning_fg_color": argb_to_color_code(dark_theme.primary, "0.8"),
|
|
||||||
"error_color": argb_to_color_code(dark_theme.error),
|
|
||||||
"error_bg_color": argb_to_color_code(dark_theme.errorContainer),
|
|
||||||
"error_fg_color": argb_to_color_code(dark_theme.onError),
|
|
||||||
"window_bg_color": argb_to_color_code(dark_theme.surface),
|
|
||||||
"window_fg_color": argb_to_color_code(dark_theme.onSurface),
|
|
||||||
"view_bg_color": argb_to_color_code(dark_theme.surface),
|
|
||||||
"view_fg_color": argb_to_color_code(dark_theme.onSurface),
|
|
||||||
"headerbar_bg_color": argb_to_color_code(dark_theme.surface),
|
|
||||||
"headerbar_fg_color": argb_to_color_code(dark_theme.onSurface),
|
|
||||||
"headerbar_border_color": argb_to_color_code(
|
|
||||||
dark_theme.primary, "0.8"
|
|
||||||
),
|
|
||||||
"headerbar_backdrop_color": "@headerbar_bg_color",
|
|
||||||
"headerbar_shade_color": argb_to_color_code(dark_theme.shadow),
|
|
||||||
"card_bg_color": argb_to_color_code(dark_theme.primary, "0.05"),
|
|
||||||
"card_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
|
||||||
"card_shade_color": argb_to_color_code(dark_theme.shadow),
|
|
||||||
"dialog_bg_color": argb_to_color_code(dark_theme.secondaryContainer),
|
|
||||||
"dialog_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
|
||||||
"popover_bg_color": argb_to_color_code(dark_theme.secondaryContainer),
|
|
||||||
"popover_fg_color": argb_to_color_code(
|
|
||||||
dark_theme.onSecondaryContainer
|
|
||||||
),
|
|
||||||
"shade_color": argb_to_color_code(dark_theme.shadow),
|
|
||||||
"scrollbar_outline_color": argb_to_color_code(dark_theme.outline),
|
|
||||||
}
|
|
||||||
elif theme == "light":
|
|
||||||
light_theme = monet_palette["schemes"]["light"]
|
light_theme = monet_palette["schemes"]["light"]
|
||||||
variable = {
|
variable = {
|
||||||
"accent_color": argb_to_color_code(light_theme.primary),
|
"accent_color": argb_to_color_code(light_theme.primary),
|
||||||
|
@ -116,51 +73,72 @@ class PresetUtils:
|
||||||
"accent_fg_color": argb_to_color_code(light_theme.onPrimary),
|
"accent_fg_color": argb_to_color_code(light_theme.onPrimary),
|
||||||
"destructive_color": argb_to_color_code(light_theme.error),
|
"destructive_color": argb_to_color_code(light_theme.error),
|
||||||
"destructive_bg_color": argb_to_color_code(light_theme.errorContainer),
|
"destructive_bg_color": argb_to_color_code(light_theme.errorContainer),
|
||||||
"destructive_fg_color": argb_to_color_code(
|
"destructive_fg_color": argb_to_color_code(light_theme.onErrorContainer),
|
||||||
light_theme.onErrorContainer
|
|
||||||
),
|
|
||||||
"success_color": argb_to_color_code(light_theme.tertiary),
|
"success_color": argb_to_color_code(light_theme.tertiary),
|
||||||
"success_bg_color": argb_to_color_code(light_theme.tertiaryContainer),
|
"success_bg_color": argb_to_color_code(light_theme.tertiaryContainer),
|
||||||
"success_fg_color": argb_to_color_code(
|
"success_fg_color": argb_to_color_code(light_theme.onTertiaryContainer),
|
||||||
light_theme.onTertiaryContainer
|
|
||||||
),
|
|
||||||
"warning_color": argb_to_color_code(light_theme.secondary),
|
"warning_color": argb_to_color_code(light_theme.secondary),
|
||||||
"warning_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
"warning_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
||||||
"warning_fg_color": argb_to_color_code(
|
"warning_fg_color": argb_to_color_code(light_theme.onSecondaryContainer),
|
||||||
light_theme.onSecondaryContainer
|
|
||||||
),
|
|
||||||
"error_color": argb_to_color_code(light_theme.error),
|
"error_color": argb_to_color_code(light_theme.error),
|
||||||
"error_bg_color": argb_to_color_code(light_theme.errorContainer),
|
"error_bg_color": argb_to_color_code(light_theme.errorContainer),
|
||||||
"error_fg_color": argb_to_color_code(light_theme.onError),
|
"error_fg_color": argb_to_color_code(light_theme.onError),
|
||||||
"window_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
"window_bg_color": argb_to_color_code(light_theme.surface),
|
||||||
"window_fg_color": argb_to_color_code(light_theme.onSurface),
|
"window_fg_color": argb_to_color_code(light_theme.onSurface),
|
||||||
"view_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
"view_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
||||||
"view_fg_color": argb_to_color_code(light_theme.onSurface),
|
"view_fg_color": argb_to_color_code(light_theme.onSurface),
|
||||||
"headerbar_bg_color": argb_to_color_code(
|
"headerbar_bg_color": argb_to_color_code(light_theme.primary, "0.08"),
|
||||||
light_theme.secondaryContainer
|
"headerbar_fg_color": argb_to_color_code(light_theme.onSecondaryContainer),
|
||||||
),
|
"headerbar_border_color": argb_to_color_code(light_theme.onSurface, "0.8"),
|
||||||
"headerbar_fg_color": argb_to_color_code(light_theme.onSurface),
|
"headerbar_backdrop_color": "@window_bg_color",
|
||||||
"headerbar_border_color": argb_to_color_code(
|
"headerbar_shade_color": argb_to_color_code(light_theme.onSurface, "0.07"),
|
||||||
light_theme.primary, "0.8"
|
|
||||||
),
|
|
||||||
"headerbar_backdrop_color": "@headerbar_bg_color",
|
|
||||||
"headerbar_shade_color": argb_to_color_code(
|
|
||||||
light_theme.secondaryContainer
|
|
||||||
),
|
|
||||||
"card_bg_color": argb_to_color_code(light_theme.primary, "0.05"),
|
"card_bg_color": argb_to_color_code(light_theme.primary, "0.05"),
|
||||||
"card_fg_color": argb_to_color_code(light_theme.onSecondaryContainer),
|
"card_fg_color": argb_to_color_code(light_theme.onSecondaryContainer),
|
||||||
"card_shade_color": argb_to_color_code(light_theme.shadow),
|
"card_shade_color": argb_to_color_code(light_theme.shadow, "0.07"),
|
||||||
"dialog_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
"dialog_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
||||||
"dialog_fg_color": argb_to_color_code(
|
"dialog_fg_color": argb_to_color_code(light_theme.onSecondaryContainer),
|
||||||
light_theme.onSecondaryContainer
|
|
||||||
),
|
|
||||||
"popover_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
"popover_bg_color": argb_to_color_code(light_theme.secondaryContainer),
|
||||||
"popover_fg_color": argb_to_color_code(
|
"popover_fg_color": argb_to_color_code(light_theme.onSecondaryContainer),
|
||||||
light_theme.onSecondaryContainer
|
"shade_color": argb_to_color_code(light_theme.shadow, "0.07"),
|
||||||
),
|
|
||||||
"shade_color": argb_to_color_code(light_theme.shadow),
|
|
||||||
"scrollbar_outline_color": argb_to_color_code(light_theme.outline),
|
"scrollbar_outline_color": argb_to_color_code(light_theme.outline),
|
||||||
}
|
}
|
||||||
|
elif theme == "dark":
|
||||||
|
dark_theme = monet_palette["schemes"]["dark"]
|
||||||
|
variable = {
|
||||||
|
"accent_color": argb_to_color_code(dark_theme.primary),
|
||||||
|
"accent_bg_color": argb_to_color_code(dark_theme.primary),
|
||||||
|
"accent_fg_color": argb_to_color_code(dark_theme.onPrimary),
|
||||||
|
"destructive_color": argb_to_color_code(dark_theme.error),
|
||||||
|
"destructive_bg_color": argb_to_color_code(dark_theme.errorContainer),
|
||||||
|
"destructive_fg_color": argb_to_color_code(dark_theme.onErrorContainer),
|
||||||
|
"success_color": argb_to_color_code(dark_theme.tertiary),
|
||||||
|
"success_bg_color": argb_to_color_code(dark_theme.tertiaryContainer),
|
||||||
|
"success_fg_color": argb_to_color_code(dark_theme.onTertiaryContainer),
|
||||||
|
"warning_color": argb_to_color_code(dark_theme.secondary),
|
||||||
|
"warning_bg_color": argb_to_color_code(dark_theme.secondaryContainer),
|
||||||
|
"warning_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
||||||
|
"error_color": argb_to_color_code(dark_theme.error),
|
||||||
|
"error_bg_color": argb_to_color_code(dark_theme.errorContainer),
|
||||||
|
"error_fg_color": argb_to_color_code(dark_theme.onError),
|
||||||
|
"window_bg_color": argb_to_color_code(dark_theme.surface),
|
||||||
|
"window_fg_color": argb_to_color_code(dark_theme.onSurface),
|
||||||
|
"view_bg_color": argb_to_color_code(dark_theme.secondaryContainer),
|
||||||
|
"view_fg_color": argb_to_color_code(dark_theme.onSurface),
|
||||||
|
"headerbar_bg_color": argb_to_color_code(dark_theme.primary, "0.08"),
|
||||||
|
"headerbar_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
||||||
|
"headerbar_border_color": argb_to_color_code(dark_theme.onSurface, "0.8"),
|
||||||
|
"headerbar_backdrop_color": "@window_bg_color",
|
||||||
|
"headerbar_shade_color": argb_to_color_code(dark_theme.onSurface, "0.07"),
|
||||||
|
"card_bg_color": argb_to_color_code(dark_theme.primary, "0.05"),
|
||||||
|
"card_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
||||||
|
"card_shade_color": argb_to_color_code(dark_theme.shadow, "0.07"),
|
||||||
|
"dialog_bg_color": argb_to_color_code(dark_theme.secondaryContainer),
|
||||||
|
"dialog_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
||||||
|
"popover_bg_color": argb_to_color_code(dark_theme.secondaryContainer),
|
||||||
|
"popover_fg_color": argb_to_color_code(dark_theme.onSecondaryContainer),
|
||||||
|
"shade_color": argb_to_color_code(dark_theme.shadow, "0.36"),
|
||||||
|
"scrollbar_outline_color": argb_to_color_code(dark_theme.outline, "0.5"),
|
||||||
|
}
|
||||||
|
|
||||||
if obj_only == False and not name:
|
if obj_only == False and not name:
|
||||||
raise AttributeError("You either need to set 'obj_only' property to True, or add value to 'name' property")
|
raise AttributeError("You either need to set 'obj_only' property to True, or add value to 'name' property")
|
||||||
|
|
Loading…
Reference in a new issue