materialyoucolor-python icon indicating copy to clipboard operation
materialyoucolor-python copied to clipboard

Missing module import - materialyoucolor.utils.image_utils

Open MateuszCebula opened this issue 6 months ago • 2 comments

When importing theme_from_source_color from materialyoucolor.utils.theme_utils, I found following missing import causing crash: (<class 'ModuleNotFoundError'>, ModuleNotFoundError("No module named 'materialyoucolor.utils.image_utils'"))

Code snippet: from materialyoucolor.utils.theme_utils import theme_from_source_color from materialyoucolor.utils.color_utils import argb_from_rgb

theme = theme_from_source_color(argb_from_rgb(255, 0, 0, 255))

Edit: commenting line in theme_utils: #from materialyoucolor.utils.image_utils import source_color_from_image Seems not to break the theme_from_source_color, but I do not know about other utilities.

MateuszCebula avatar Jul 14 '25 20:07 MateuszCebula

Refer examples of README.

# Color in hue, chroma, tone form
from materialyoucolor.hct import Hct
from materialyoucolor.dynamiccolor.material_dynamic_colors import MaterialDynamicColors

# There are 9 different variants of scheme.
from materialyoucolor.scheme.scheme_tonal_spot import SchemeTonalSpot
# Others you can import: SchemeExpressive, SchemeFruitSalad, SchemeMonochrome, SchemeRainbow, SchemeVibrant, SchemeNeutral, SchemeFidelity and SchemeContent

# SchemeTonalSpot is android default
scheme = SchemeTonalSpot( # choose any scheme here
    Hct.from_int(0xff4181EE), # source color in hct form
    True, # dark mode
    0.0, # contrast
)

for color in vars(MaterialDynamicColors).keys():
    color_name = getattr(MaterialDynamicColors, color)
    if hasattr(color_name, "get_hct"): # is a color
        print(color, color_name.get_hct(scheme).to_rgba()) # print name of color and value in rgba format

# background [14, 20, 21, 255]
# onBackground [222, 227, 229, 255]
# surface [14, 20, 21, 255]
# surfaceDim [14, 20, 21, 255]
# ...

T-Dynamos avatar Jul 15 '25 02:07 T-Dynamos

Ok, I see. Thank you for your response. Still - it would be nice, if things that are not working were either fixed or removed, but it is up to you. Have a great day.

MateuszCebula avatar Jul 15 '25 10:07 MateuszCebula