svgen.color.theme package#
Submodules#
svgen.color.theme.manager module#
A module implementing a color-theme manager.
- class svgen.color.theme.manager.ColorThemeManager(initialdata: Dict[str, ColorTheme] = None, theme: str = '')[source]#
Bases:
UserDict
,LoggerMixin
,MutableMapping
[str
,ColorTheme
]A class for managing color themes.
- add_themes(*themes: ColorTheme) None [source]#
Add new themes to the manager.
- property size: int#
Get the number of managed themes.
svgen.color.theme.visualize module#
A module for visualizing color themes.
- svgen.color.theme.visualize.visualize(rect: Rectangle, manager: ColorThemeManager = None, columns: bool = True) Iterator[Rect] [source]#
Visualize all managed themes within a provided rectangle.
- svgen.color.theme.visualize.visualize_theme(theme: ColorTheme | str, rect: Rectangle, columns: bool = True) Iterator[Rect] [source]#
Create filled rectangle elements for this theme inside another rectangle.
Module contents#
A module for working with color themes.
- class svgen.color.theme.ColorTheme(name: str, initialdata: Dict[str, str | Hsl | Rgb | Color] = None, namespace: Namespace = None)[source]#
Bases:
UserDict
,NamespaceMixin
,MutableMapping
[str
,Color
]A class implementing a theme color interface.
- create(color: str | Hsl | Rgb | Color) Color [source]#
Attempt to create a color through this theme so that existing tokens can be used as color aliases.
- static from_path(path: Path | str | None) ColorTheme [source]#
Load a color theme from a data file on disk.
- lookup(key: str) Tuple[str, Color | None] [source]#
Attempt to find an existing color in this theme by key.
- resolve(key: str, strict: bool = False) ColorToken [source]#
Attempt to resolve a color key as a theme color.
- property size: int#
Get the number of colors in this theme.