bokeh.colors#

Provide classes for representing RGB(A) and HSL(A) colors, as well as define common named colors.

bokeh.colors.Color#

Provide a base class for representing color values.

class Color[source]#

A base class for representing color objects.

abstractmethod classmethod from_hsl(value: HSL) Self[source]#

Create a new color by converting from an HSL color.

Subclasses must implement this method.

Parameters:

value (HSL) – A color to convert from HSL

Returns:

Color

abstractmethod classmethod from_rgb(value: RGB) Self[source]#

Create a new color by converting from an RGB color.

Subclasses must implement this method.

Parameters:

value (RGB) – A color to convert from RGB

Returns:

Color

static clamp(value: float, maximum: float | None = None) float[source]#

Clamp numeric values to be non-negative, an optionally, less than a given maximum.

Parameters:
  • value (float) – A number to clamp.

  • maximum (float, optional) – A max bound to to clamp to. If None, there is no upper bound, and values are only clamped to be non-negative. (default: None)

Returns:

float

abstractmethod copy() Self[source]#

Copy this color.

Subclasses must implement this method.

darken(amount: float) Self[source]#

Darken (reduce the luminance) of this color.

Subclasses must implement this method.

Parameters:

amount (float) – Amount to reduce the luminance by (clamped above zero)

Returns:

Color

lighten(amount: float) Self[source]#

Lighten (increase the luminance) of this color.

Subclasses must implement this method.

Parameters:

amount (float) – Amount to increase the luminance by (clamped above zero)

Returns:

Color

abstractmethod to_css() str[source]#

Return a CSS representation of this color.

Subclasses must implement this method.

Returns:

str

abstractmethod to_hsl() HSL[source]#

Create a new HSL color by converting from this color.

Subclasses must implement this method.

Returns:

HSL

abstractmethod to_rgb() RGB[source]#

Create a new HSL color by converting from this color.

Subclasses must implement this method.

Returns:

RGB

to_serializable(serializer: Serializer) Any[source]#

Converts this object to a serializable representation.

bokeh.colors.groups#

Organize CSS named colors into useful groups according to general hue.

class black[source]#

CSS “Black” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

gainsboro
lightgray
silver
darkgray
gray
dimgray
lightslategray
slategray
darkslategray
black
class blue[source]#

CSS “Blue” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

lightsteelblue
powderblue
lightblue
skyblue
lightskyblue
deepskyblue
dodgerblue
cornflowerblue
steelblue
royalblue
blue
mediumblue
darkblue
navy
midnightblue
class brown[source]#

CSS “Brown” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

cornsilk
blanchedalmond
bisque
navajowhite
wheat
burlywood
tan
rosybrown
sandybrown
goldenrod
darkgoldenrod
peru
chocolate
saddlebrown
sienna
brown
maroon
class cyan[source]#

CSS “Cyan” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

mediumaquamarine
aqua
cyan
lightcyan
paleturquoise
aquamarine
turquoise
mediumturquoise
darkturquoise
lightseagreen
cadetblue
darkcyan
teal
class green[source]#

CSS “Green” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

darkolivegreen
olive
olivedrab
yellowgreen
limegreen
lime
lawngreen
chartreuse
greenyellow
springgreen
mediumspringgreen
lightgreen
palegreen
darkseagreen
mediumseagreen
seagreen
forestgreen
green
darkgreen
class orange[source]#

CSS “Orange” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

orangered
tomato
coral
darkorange
orange
class pink[source]#

CSS “Pink” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

pink
lightpink
hotpink
deeppink
palevioletred
mediumvioletred
class purple[source]#

CSS “Purple” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

lavender
thistle
plum
violet
orchid
fuchsia
magenta
mediumorchid
mediumpurple
blueviolet
darkviolet
darkorchid
darkmagenta
purple
indigo
darkslateblue
slateblue
mediumslateblue
class red[source]#

CSS “Red” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

lightsalmon
salmon
darksalmon
lightcoral
indianred
crimson
firebrick
darkred
red
class white[source]#

CSS “White” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

white
snow
honeydew
mintcream
azure
aliceblue
ghostwhite
whitesmoke
seashell
beige
oldlace
floralwhite
ivory
antiquewhite
linen
lavenderblush
mistyrose
class yellow[source]#

CSS “Yellow” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp

yellow
lightyellow
lemonchiffon
lightgoldenrodyellow
papayawhip
moccasin
peachpuff
palegoldenrod
khaki
darkkhaki
gold

bokeh.colors.named#

Provide the standard 147 CSS (X11) named colors.