Pancils is a Python library with a colletion of color palettes.
Currently available palettes:
- Everything from flatuicolors.com
- Most of the palettes from materialui.co
- Tailwind color palette.
- Bootstrap color palette.
- CSS (HTML) color names.
Features:
- A lot of colors from manually picked palettes.
- 100% type safe.
- Best integration with IDEs, autocomplete all the way down.
- Includes multiple representations (HEX, RGB, HSL) for each color.
- Zero-dependency.
Installatiion:
python3 -m pip install pencils
Get the hex representation of "Sunflower" color from Dutch Palette of Flat UI Colors:
import pencils
pencils.NLPalette.colors.sunflower.value.hex
# 'FFC312'
That's a lot of attributes and each one of them has a meaning:
NLPalette
is an instance of thepencils.Palette
class which holds information about palette name, author, source URL, and even emojis associated with the palette.colors
attribute is an enum, a subclass ofpencils.Colors
.sunflower
is the color ID.value
is used to get the value of the enum. The value is an instance ofpencils.Color
class which contains operations on colors.hex
is a lowercase hex representaion of the color without#
.
Make the color darker:
color = pencils.NLPalette.colors.sunflower.value.hsl
color.lightness = .2
color.hex
# '664c00'
Get random color from a random palette:
pencils.random_palette().random_color()
# Color(name='Unmellow Yellow', hex='fffa65')