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

rgb_to_hex(rgb)[source]

Convert a rgb color value to hex color code

rgb : list
a list consisting of three rgb values. It can either be from 0 to 255 or from 0 to 1.
string
the hex code
rgb_to_hls(rgbval)[source]

Convert a rgb value to equivalent hls value

rgbval : list
A list of three values containing rgb for the color
hls : list
A list of hls values

rgb values should be between 0-255

pychromatic.palette module

Main file containing the Palette class

class pychromatic.palette.Palette(palette='default', type='')[source]

Bases: pychromatic.cutils.Color_utils

Palette class is the main class of pychromatic that is initialised

assign_palette(palette_name)[source]

Assign a palatte to the class

palette_name : string
name of the palette

None

palette
plot_colors(limit=None, minimal=False)[source]

Wrap around inherited plot function

random_palette(type=None)[source]

Assign a random palette

None

None

Module contents