Color Palette¶
morphui.theme.palette
¶
MorphDynamicColorPalette(**kwargs)
¶
Bases: EventDispatcher
A comprehensive dynamic color palette class for MorphUI themes,
providing a wide range of color properties based on Material Design
guidelines. Each property is a Kivy ColorProperty that holds a
dynamic color value, allowing for flexible and adaptive theming.
| ATTRIBUTE | DESCRIPTION |
|---|---|
material_color_map |
Maps color property names to MaterialDynamicColors instances for easy reference and dynamic color scheme application.
TYPE:
|
Key color properties |
The following attributes represent key colors for palettes and
UI elements, each as a
|
Core UI colors |
|
Outline and shadow colors |
|
Tint and accent colors |
|
Primary, secondary, tertiary, and error colors |
(and their containers and text variants) - primary_color, content_primary_color, primary_container_color, content_primary_container_color, inverse_primary_color - secondary_color, content_secondary_color, secondary_container_color, content_secondary_container_color - tertiary_color, content_tertiary_color, tertiary_container_color, content_tertiary_container_color - error_color, content_error_color, error_container_color, content_error_container_color
|
Fixed palette colors for accessibility and contrast |
|
Notes
Material colors starting with 'on_' (like 'on_background', 'on_primary') are renamed to 'content_' prefixed variants (like 'content_background_color', 'content_primary_color') to avoid conflicts with Kivy's event handling system which treats attributes starting with 'on_' as event handlers.
Usage
Use this class to define and manage dynamic theme colors for MorphUI-based applications, ensuring consistency and adaptability across different UI components and states.
material_color_map = AliasProperty(lambda self: self._material_color_map, bind=['_material_color_map'])
class-attribute
instance-attribute
¶
Get the mapping of color property names to DynamicScheme properties (read-only).
This mapping is used internally to apply color schemes to all available color properties. Returns a dictionary where: - Keys are MorphUI color property names (e.g., 'primary_color', 'content_surface_color') - Values are the corresponding DynamicScheme property names (e.g., 'primary', 'on_surface')
:attr:material_color_map is a
:class:~kivy.properties.AliasProperty that provides read-only
access to the internal color property mapping.
dynamic_color_properties = AliasProperty(lambda self: list(self._material_color_map.keys()), bind=['_material_color_map'])
class-attribute
instance-attribute
¶
List of all dynamic color property names in the palette.
This property returns a list of strings representing the names of all dynamic color properties defined in the palette. These names correspond to the attributes that hold dynamic color values, allowing for easy iteration and management of colors.
:attr:dynamic_color_properties is a
:class:~kivy.properties.AliasProperty that provides read-only
access to the list of dynamic color property names.
colors_initialized = AliasProperty(_get_colors_initialized, cache=True, bind=['primary_color', 'background_color', 'surface_color', 'content_surface_color'])
class-attribute
instance-attribute
¶
Check if dynamic colors have been initialized.
Returns True if at least one color property has been set with a non-None value, indicating that the color scheme has been applied. Returns False if all color properties are None.
:attr:colors_initialized is a
:class:~kivy.properties.AliasProperty that provides read-only
access to the color initialization status.
all_colors_set = AliasProperty(_get_all_colors_set)
class-attribute
instance-attribute
¶
Check if all color properties have been initialized.
Returns True only if all color properties in the palette have been
set with non-None values. This is a more strict check than
:attr:colors_initialized.
:attr:all_colors_set is a
:class:~kivy.properties.AliasProperty that provides read-only
access to the all colors set status.
transparent_color = ColorProperty([0, 0, 0, 0])
class-attribute
instance-attribute
¶
Transparent color. This property is always [0, 0, 0, 0] and does not change with the theme. It is provided for convenience.
:attr:transparent_color is a
:class:~kivy.properties.ColorProperty that holds a static color
value and defaults to [0, 0, 0, 0] (fully transparent).
background_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Background color. This property holds the dynamic color value set by the theme.
:attr:background_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_background_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content background color. This property holds the dynamic color value set by the theme.
:attr:content_background_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_error_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content error color. This property holds the dynamic color value set by the theme.
:attr:content_error_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_error_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content error container color. This property holds the dynamic color value set by the theme.
:attr:content_error_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_primary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content primary color. This property holds the dynamic color value set by the theme.
:attr:content_primary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_primary_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content primary container color. This property holds the dynamic color value set by the theme.
:attr:content_primary_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_primary_fixed_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content primary fixed color. This property holds the dynamic color value set by the theme.
:attr:content_primary_fixed_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_primary_fixed_variant_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content primary fixed variant color. This property holds the dynamic color value set by the theme.
:attr:content_primary_fixed_variant_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_secondary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content secondary color. This property holds the dynamic color value set by the theme.
:attr:content_secondary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_secondary_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content secondary container color. This property holds the dynamic color value set by the theme.
:attr:content_secondary_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_secondary_fixed_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content secondary fixed color. This property holds the dynamic color value set by the theme.
:attr:content_secondary_fixed_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_secondary_fixed_variant_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content secondary fixed variant color. This property holds the dynamic color value set by the theme.
:attr:content_secondary_fixed_variant_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_surface_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content surface color. This property holds the dynamic color value set by the theme.
:attr:content_surface_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_surface_variant_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content surface variant color. This property holds the dynamic color value set by the theme.
:attr:content_surface_variant_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_tertiary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content tertiary color. This property holds the dynamic color value set by the theme.
:attr:content_tertiary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_tertiary_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content tertiary container color. This property holds the dynamic color value set by the theme.
:attr:content_tertiary_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_tertiary_fixed_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content tertiary fixed color. This property holds the dynamic color value set by the theme.
:attr:content_tertiary_fixed_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
content_tertiary_fixed_variant_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Content tertiary fixed variant color. This property holds the dynamic color value set by the theme.
:attr:content_tertiary_fixed_variant_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
error_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Error color. This property holds the dynamic color value set by the theme.
:attr:error_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
error_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Error container color. This property holds the dynamic color value set by the theme.
:attr:error_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
inverse_content_surface_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Inverse on surface color. This property holds the dynamic color value set by the theme.
:attr:inverse_content_surface_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
inverse_primary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Inverse primary color. This property holds the dynamic color value set by the theme.
:attr:inverse_primary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
inverse_surface_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Inverse surface color. This property holds the dynamic color value set by the theme.
:attr:inverse_surface_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
outline_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Outline color. This property holds the dynamic color value set by the theme.
:attr:outline_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
outline_variant_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Outline variant color. This property holds the dynamic color value set by the theme.
:attr:outline_variant_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
primary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Primary color. This property holds the dynamic color value set by the theme.
:attr:primary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
primary_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Primary container color. This property holds the dynamic color value set by the theme.
:attr:primary_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
primary_fixed_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Primary fixed color. This property holds the dynamic color value set by the theme.
:attr:primary_fixed_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
primary_fixed_dim_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Primary fixed dim color. This property holds the dynamic color value set by the theme.
:attr:primary_fixed_dim_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
scrim_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Scrim color. This property holds the dynamic color value set by the theme.
:attr:scrim_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
secondary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Secondary color. This property holds the dynamic color value set by the theme.
:attr:secondary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
secondary_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Secondary container color. This property holds the dynamic color value set by the theme.
:attr:secondary_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
secondary_fixed_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Secondary fixed color. This property holds the dynamic color value set by the theme.
:attr:secondary_fixed_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
secondary_fixed_dim_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Secondary fixed dim color. This property holds the dynamic color value set by the theme.
:attr:secondary_fixed_dim_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
shadow_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Shadow color. This property holds the dynamic color value set by the theme.
:attr:shadow_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_bright_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface bright color. This property holds the dynamic color value set by the theme.
:attr:surface_bright_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface color. This property holds the dynamic color value set by the theme.
:attr:surface_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface container color. This property holds the dynamic color value set by the theme.
:attr:surface_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_container_high_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface container high color. This property holds the dynamic color value set by the theme.
:attr:surface_container_high_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_container_highest_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface container highest color. This property holds the dynamic color value set by the theme.
:attr:surface_container_highest_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_container_low_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface container low color. This property holds the dynamic color value set by the theme.
:attr:surface_container_low_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_container_lowest_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface container lowest color. This property holds the dynamic color value set by the theme.
:attr:surface_container_lowest_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_dim_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface dim color. This property holds the dynamic color value set by the theme.
:attr:surface_dim_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_tint_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface tint color. This property holds the dynamic color value set by the theme.
:attr:surface_tint_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
surface_variant_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Surface variant color. This property holds the dynamic color value set by the theme.
:attr:surface_variant_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
tertiary_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Tertiary color. This property holds the dynamic color value set by the theme.
:attr:tertiary_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
tertiary_container_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Tertiary container color. This property holds the dynamic color value set by the theme.
:attr:tertiary_container_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
tertiary_fixed_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Tertiary fixed color. This property holds the dynamic color value set by the theme.
:attr:tertiary_fixed_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
tertiary_fixed_dim_color = ColorProperty(None)
class-attribute
instance-attribute
¶
Tertiary fixed dim color. This property holds the dynamic color value set by the theme.
:attr:tertiary_fixed_dim_color is a
:class:~kivy.properties.ColorProperty that holds a dynamic color
value and defaults to None
create_color_property_mapping()
¶
Create a mapping between MorphUI color property names and material-color-utilities DynamicScheme color property names.
| RETURNS | DESCRIPTION |
|---|---|
Dict[str, str]
|
Mapping from MorphUI property name to DynamicScheme property name. |