ColorDict Class
Module containing the main class of the colordict package: ColorDict.
- class colordict.cdict.ColorDict(palettes=None, palettes_path='', color_space=<class 'colordict.color.sRGBColor'>, **kwargs)
Bases:
object
Class that holds colors extracted from palettes.
- Parameters
palettes (list) – List of palettes located in the
palettes_path
directory that should be loaded by this ColorDict instance. By default, loads all palettes.palettes_path (str) – Path from which the palettes specified in the
palettes
parameter will be loaded. Defaults to “…/colordict/palettes”.color_space (Type[colordict.color.ColorBase]) – Which color class should be used to load the colors. Any of the defined color classes can be used.
**kwargs – Any other keyword argument specified in this constructor will be passed on to the constructor of the color class identified in the color_space parameter.
Examples
c = ColorDict(color_space=sRGBColor, norm=1)
Will create a
ColorDict
where all color entries aresRGBColor
objects that have their norm attribute set to 1.- colors
A list of all colors currently loaded in the
ColorDict
.
- palettes
A dictionary containing all palettes currently loaded in the
ColorDict
. The palettes are keys in the dictionary which map to a list of color names.
- color_space
Stores the value passed to the constructor in the
color_space
parameter. This property is read-only and can’t be set outside the ColorDict constructor.
- palettes_path
Stores the value passed to the constructor in the
palettes_path
parameter.
- get_color(color_name)
- named(color)
- add(name, color, palette='independent', check=True)
- update(name, color)
- remove(name, palette)
- remove_all(name)
- save()
- backup()
- restore_backup()