Tailwind Colors
Tailwind CSS color Palettes and helper functions.
PyRetailScience includes the raw Tailwind CSS color palettes and ListedColormaps and LinearSegmentedColormaps versions for use when charting.
Colors from Tailwind CSS https://raw.githubusercontent.com/tailwindlabs/tailwindcss/a1e74f055b13a7ef5775bdd72a77a4d397565016/src/public/colors.js
get_base_cmap()
Returns a ListedColormap with all the Tailwind colors.
Returns:
Name | Type | Description |
---|---|---|
ListedColormap |
ListedColormap
|
A ListedColormap with all the Tailwind colors. |
Source code in pyretailscience/style/tailwind.py
get_color_list(name, starting_color_code=50, ending_color_code=950)
Returns a filtered list of colors from the Tailwind color palette based on the given range.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the color palette (e.g., "blue", "red"). |
required |
starting_color_code |
int
|
The lowest color shade to use (default: 50). |
50
|
ending_color_code |
int
|
The highest color shade to use (default: 950). |
950
|
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: A filtered list of colors from the Tailwind color palette. |
Source code in pyretailscience/style/tailwind.py
get_linear_cmap(name, starting_color_code=50, ending_color_code=950)
Returns a linear segmented colormap using Tailwind colors.
This function allows restricting the color range used in the colormap.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the Tailwind color (e.g., "blue", "red"). |
required |
starting_color_code |
int
|
The lowest color shade to use (default: 50). |
50
|
ending_color_code |
int
|
The highest color shade to use (default: 950). |
950
|
Returns:
Name | Type | Description |
---|---|---|
LinearSegmentedColormap |
LinearSegmentedColormap
|
A colormap object for matplotlib. |
Source code in pyretailscience/style/tailwind.py
get_listed_cmap(name)
Returns a ListedColormap from the Tailwind color pallete of the given name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the color pallete. |
required |
Returns:
Name | Type | Description |
---|---|---|
ListedColormap |
ListedColormap
|
The color pallete as a ListedColormap. |
Source code in pyretailscience/style/tailwind.py
get_multi_color_cmap()
Returns a generator for multiple Tailwind colors and shades.
Returns:
Name | Type | Description |
---|---|---|
Generator |
Generator[str, None, None]
|
A generator yielding the required colors in a looping fashion. |
Source code in pyretailscience/style/tailwind.py
get_single_color_cmap()
Returns a generator for Tailwind green shades.
Returns:
Name | Type | Description |
---|---|---|
Generator |
Generator[str, None, None]
|
A generator yielding green shades in a looping fashion. |