pychromatic package¶
Submodules¶
pychromatic.colors module¶
Module containing color palettes
pychromatic.cutils module¶
-
class
pychromatic.cutils.
Color_utils
[source]¶ Bases:
object
A class which holds the utility functions for modifying a class.
-
brighten
(color, fraction=0.05)[source]¶ Brighten or darken a color
- color : string
- the hex value of input color
- fraction : float
- the amount by which to brighten the color
- hexv : string
- the hex value of the modified color
Colors can also be darkened by providing a negative value for fraction
-
create_colormap
(colors)[source]¶ Create a color map from a list of colors
- colors : list
- a list of input colors. Atleast 2 colors are required.
cmap : color map
-
find_intermediate_colors
(color1, color2, colors=1, ignore_edges=False)[source]¶ Find a given number of intermediate colors between two input colors
- color1 : string
- hex code of the first input color
- color2 : string
- hex code of the second input color
- colors : int, optional
- number of intermediate colors required, default 1
- ignore_edges : bool, optional
- If True, the input colors are not included in the return list. Default False.
- hexvals : list
- list of intermediate colors
-
hex_to_rgb
(hexval)[source]¶ Convert a hex color value to rgb
- hexval : string
- hex color code starting with #
- rgb : list of int
- A list of rgb values between 0-255
-
hls_to_rgb
(hls)[source]¶ Convert hls value to rgb
- hls : list
- A list of hls values
- rgb : list
- list of rgb values between 0-255
-
mix_colors
(color1, color2, ratio=0.5)[source]¶ Mix two colors to get an intermediate color
- color1 : string
- hex code of the first color
- color2 : string
- hex code of the second color
- ratio : float
- ratio between color1 and color2
- hexv : string
- hex code of the intermediate color
if ratio is r, then the new color would be r*color1 + (1-r)*color2
-
plot_colors
(colors, minimal=False, title=None)[source]¶ Show plot to illustrate the colors
- colors : list
- list of colors to plot in hex values
- minimal : bool, optional
- if True, plot a minimal bar default False
None
-
pychromatic.palette module¶
Main file containing the Palette class