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.
- static clamp(value: float, maximum: Optional[float] = None) float [source]¶
Clamp numeric values to be non-negative, an optionally, less than a given maximum.
- abstract copy() bokeh.colors.color.Self [source]¶
Copy this color.
Subclasses must implement this method.
- darken(amount: float) bokeh.colors.color.Self [source]¶
Darken (reduce the luminance) of this color.
- Parameters
amount (float) – Amount to reduce the luminance by (clamped above zero)
- Returns
Color
- abstract 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
- abstract 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
- lighten(amount: float) bokeh.colors.color.Self [source]¶
Lighten (increase the luminance) of this color.
- Parameters
amount (float) – Amount to increase the luminance by (clamped above zero)
- Returns
Color
- abstract to_css() str [source]¶
Return a CSS representation of this color.
Subclasses must implement this method.
- Returns
str
bokeh.colors.HSL¶
Provide a class to represent colors with HSL (Hue, Saturation, Value).
- class HSL(h: float, s: float, l: float, a: float = 1.0)[source]¶
Represent colors by specifying their Hue, Saturation, and lightness.
Alpha values may also optionally be provided. Otherwise, alpha values default to 1.
Warning
HSL is deprecated as of Bokeh 2.3.1 and will be removed in a future release. Use RGB or named colors instead.
- static clamp(value: float, maximum: Optional[float] = None) float ¶
Clamp numeric values to be non-negative, an optionally, less than a given maximum.
- copy() bokeh.colors.hsl.HSL [source]¶
Return a copy of this color value.
- Returns
- darken(amount: float) bokeh.colors.color.Self ¶
Darken (reduce the luminance) of this color.
- Parameters
amount (float) – Amount to reduce the luminance by (clamped above zero)
- Returns
Color
- classmethod from_hsl(value: bokeh.colors.hsl.HSL) bokeh.colors.hsl.HSL [source]¶
Copy an HSL color from another HSL color value.
- lighten(amount: float) bokeh.colors.color.Self ¶
Lighten (increase the luminance) of this color.
- Parameters
amount (float) – Amount to increase the luminance by (clamped above zero)
- Returns
Color
- to_css() str [source]¶
Generate the CSS representation of this HSL color.
- Returns
str,
"hsl(...)"
or"hsla(...)"
- to_hsl() bokeh.colors.hsl.HSL [source]¶
Return a HSL copy for this HSL color.
- Returns
bokeh.colors.RGB¶
- class RGB(r: int, g: int, b: int, a: float = 1.0)[source]¶
Represent colors by specifying their Red, Green, and Blue channels.
Alpha values may also optionally be provided. Otherwise, alpha values default to 1.
- static clamp(value: float, maximum: Optional[float] = None) float ¶
Clamp numeric values to be non-negative, an optionally, less than a given maximum.
- copy() bokeh.colors.rgb.RGB [source]¶
Return a copy of this color value.
- Returns
- darken(amount: float) bokeh.colors.color.Self ¶
Darken (reduce the luminance) of this color.
- Parameters
amount (float) – Amount to reduce the luminance by (clamped above zero)
- Returns
Color
- classmethod from_rgb(value: bokeh.colors.rgb.RGB) bokeh.colors.rgb.RGB [source]¶
Copy an RGB color from another RGB color value.
- lighten(amount: float) bokeh.colors.color.Self ¶
Lighten (increase the luminance) of this color.
- Parameters
amount (float) – Amount to increase the luminance by (clamped above zero)
- Returns
Color
- to_css() str [source]¶
Generate the CSS representation of this RGB color.
- Returns
str,
"rgb(...)"
or"rgba(...)"
- to_hex() str [source]¶
Return a hex color string for this RGB color.
Any alpha value on this color is discarded, only hex color strings for the RGB components are returned.
- Returns
str,
"#RRGGBB"
- to_rgb() bokeh.colors.rgb.RGB [source]¶
Return a RGB copy for this RGB color.
- Returns
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
gainsborolightgraysilverdarkgraygraydimgraylightslategrayslategraydarkslategrayblack
- class blue[source]¶
CSS “Blue” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
lightsteelbluepowderbluelightblueskybluelightskybluedeepskybluedodgerbluecornflowerbluesteelblueroyalbluebluemediumbluedarkbluenavymidnightblue
- class brown[source]¶
CSS “Brown” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
cornsilkblanchedalmondbisquenavajowhitewheatburlywoodtanrosybrownsandybrowngoldenroddarkgoldenrodperuchocolatesaddlebrownsiennabrownmaroon
- class cyan[source]¶
CSS “Cyan” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
mediumaquamarineaquacyanlightcyanpaleturquoiseaquamarineturquoisemediumturquoisedarkturquoiselightseagreencadetbluedarkcyanteal
- class green[source]¶
CSS “Green” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
darkolivegreenoliveolivedrabyellowgreenlimegreenlimelawngreenchartreusegreenyellowspringgreenmediumspringgreenlightgreenpalegreendarkseagreenmediumseagreenseagreenforestgreengreendarkgreen
- class orange[source]¶
CSS “Orange” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
orangeredtomatocoraldarkorangeorange
- class pink[source]¶
CSS “Pink” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
pinklightpinkhotpinkdeeppinkpalevioletredmediumvioletred
- class purple[source]¶
CSS “Purple” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
lavenderthistleplumvioletorchidfuchsiamagentamediumorchidmediumpurplebluevioletdarkvioletdarkorchiddarkmagentapurpleindigodarkslateblueslatebluemediumslateblue
- class red[source]¶
CSS “Red” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
lightsalmonsalmondarksalmonlightcoralindianredcrimsonfirebrickdarkredred
- class white[source]¶
CSS “White” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
whitesnowhoneydewmintcreamazurealiceblueghostwhitewhitesmokeseashellbeigeoldlacefloralwhiteivoryantiquewhitelinenlavenderblushmistyrose
- class yellow[source]¶
CSS “Yellow” Color Group as defined by https://www.w3schools.com/colors/colors_groups.asp
yellowlightyellowlemonchiffonlightgoldenrodyellowpapayawhipmoccasinpeachpuffpalegoldenrodkhakidarkkhakigold
bokeh.colors.named¶
Provide the standard 147 CSS (X11) named colors.