mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-05 23:09:27 -05:00
fix: compat for python-materialyoucolor < 3.0.0
This commit is contained in:
@@ -172,9 +172,15 @@ def gen_scheme(scheme, primary: Hct) -> dict[str, str]:
|
|||||||
|
|
||||||
# Material colours
|
# Material colours
|
||||||
primary_scheme = get_scheme(scheme.variant)(primary, not light, 0)
|
primary_scheme = get_scheme(scheme.variant)(primary, not light, 0)
|
||||||
dyn_colours = MaterialDynamicColors()
|
if hasattr(MaterialDynamicColors, "all_colors"): # materialyoucolor-python >= 3.0.0
|
||||||
for colour in dyn_colours.all_colors:
|
dyn_colours = MaterialDynamicColors()
|
||||||
colours[colour.name] = colour.get_hct(primary_scheme)
|
for colour in dyn_colours.all_colors:
|
||||||
|
colours[colour.name] = colour.get_hct(primary_scheme)
|
||||||
|
else:
|
||||||
|
for colour in vars(MaterialDynamicColors).keys():
|
||||||
|
colour_name = getattr(MaterialDynamicColors, colour)
|
||||||
|
if hasattr(colour_name, "get_hct"):
|
||||||
|
colours[colour] = colour_name.get_hct(primary_scheme)
|
||||||
|
|
||||||
# Backwards compatibility with old colour names
|
# Backwards compatibility with old colour names
|
||||||
if "primaryPaletteKeyColor" in colours: # materialyoucolor-python >= 3.0.0
|
if "primaryPaletteKeyColor" in colours: # materialyoucolor-python >= 3.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user