Shows a colorir object inlined on a Jupyter notebook or using tkinter.
Parameters:
inline – If running on a Jupyter notebook, whether to display the object inline.
Requires Pillow to be installed.
obj –
width –
height –
interactive – Whether clicking of the screen will copy the color value
to the clipboard and swatch the color on the terminal. Setting this
parameter to False results is a dramatic speed-up. By default,
is set to True for small objects (less than 100 colors) and
False otherwise. Only has an effect if not running on a
Jupyter notebook with inline == True.
Calculates the perceived distance between two colors.
There are many methods to approach the similarity of colors mathematically. The
algorithm implemented in this function [1] tries to provide balance between efficiency and
accuracy by using a weighted euclidian distance formula in the RGB color space.
References
Parameters:
color1 (ColorBase | str | tuple) – First color point.
color2 (ColorBase | str | tuple) – Second color point.
hue_classes – Number hue categories. Inside each hue category colors will be sorted by
luminance rather than hue. When None, colors are sorted only according to
their hue.
gray_thresh – Chroma threshold bellow which a color will be considered a shade of gray.
gray_start – Whether the colors considered shades of gray will be grouped at the start or
end of the sorted iterable.
alt_lum – Whether to alternate luminance values with each hue class transition. Only has an
effect if hue_classes > 1.
invert_lum – By default, sorting within hue classes happen from darker to lighter colors.
This parameter allows inverting this patern, thus starting with light colors and going
towards darker tones. Only has an effect if hue_classes > 1.
Notes
The refered hue and chroma components are those of HCLab.