utils
Functions¶
lighten_color(color, opacity=0.5)
¶
Change the opacity of a color.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color
|
Sequence | str
|
trace color |
required |
opacity
|
float
|
opacity factor |
0.5
|
Returns:
Type | Description |
---|---|
str
|
less opaque color as a string for plotly usage |
Source code in opentak/tak_theme/_utils.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
interpolate_colors(color_list, nb_colors, return_steps=False)
¶
Given a list of colors, create a discrete gradient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color_list
|
list[str]
|
list of colors |
required |
nb_colors
|
int
|
nb of colors to get |
required |
return_steps
|
bool
|
return float steps [0, 1]. |
False
|
Returns:
Type | Description |
---|---|
list[str] | tuple[list[str], list[float]]
|
list of colors containing plus new colors interpolated |
Source code in opentak/tak_theme/_utils.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
apply_mpl_style(fig=None)
¶
Apply theme to a matplotlib figure.
Source code in opentak/tak_theme/_utils.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
set_style()
¶
Set plotly default style to 'tak_theme'.
Source code in opentak/tak_theme/_utils.py
89 90 91 92 93 |
|