{"library":"materialyoucolor","title":"Material You Color","description":"materialyoucolor is a pure Python library that implements the Material You color generation algorithms. It allows developers to extract dominant colors from images, generate custom color palettes, and apply Material You dynamic theming principles to their applications. As of version 3.0.2, it is actively developed with periodic updates, offering a robust solution for creating adaptive and personalized user interfaces.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install materialyoucolor"],"cli":null},"imports":["from materialyoucolor.hct.hct import Hct","from materialyoucolor.quantize.quantizer_celebi import QuantizerCelebi","from materialyoucolor.scheme.scheme_fidelity import SchemeFidelity","from materialyoucolor.palettes.tonal_palette import TonalPalette"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from materialyoucolor.hct.hct import Hct\nfrom materialyoucolor.scheme.scheme_fidelity import SchemeFidelity\n\n# Define a seed color (e.g., from an image or a brand color)\nseed_hex = \"#FF00A3\" # A vibrant magenta\n\n# Convert hex string to integer for Hct\nseed_argb_int = int(seed_hex[1:], 16)\nseed_color_hct = Hct.from_int(seed_argb_int)\n\n# Generate a Material You color scheme\n# You can choose different schemes like SchemeVibrant, SchemeContent, etc.\n# Set is_dark=True for a dark theme\nscheme_light = SchemeFidelity(seed_color_hct, is_dark=False, contrast_level=0.0)\nscheme_dark = SchemeFidelity(seed_color_hct, is_dark=True, contrast_level=0.0)\n\nprint(\"--- Light Scheme ---\")\nprint(f\"Primary color: {scheme_light.primary.hex}\")\nprint(f\"On Primary color: {scheme_light.on_primary.hex}\")\nprint(f\"Background color: {scheme_light.background.hex}\")\nprint(f\"Surface color: {scheme_light.surface.hex}\")\nprint(f\"Error color: {scheme_light.error.hex}\")\n\nprint(\"\\n--- Dark Scheme ---\")\nprint(f\"Primary color: {scheme_dark.primary.hex}\")\nprint(f\"Background color: {scheme_dark.background.hex}\")\n","lang":"python","description":"This quickstart demonstrates how to generate a Material You color scheme using a seed color. It shows how to convert a hex string to the `Hct` format and then use a `SchemeFidelity` to create both light and dark themes, printing some of the key generated colors.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}