bokeh.colors#

提供用于表示RGB(A)和HSL(A)颜色的类,以及定义常见的命名颜色。

bokeh.colors.Color#

提供一个基类来表示颜色值。

class Color[source]#

表示颜色对象的基类。

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

将数值限制为非负数,并可选择性地小于给定的最大值。

Parameters:
  • value (float) – 一个需要限制范围的数字。

  • maximum (float, optional) – 一个用于夹紧的最大边界。如果为None,则没有上限,并且值仅被夹紧为非负值。(默认值: None)

Returns:

浮点数

abstract copy() Self[source]#

复制这个颜色。

子类必须实现此方法。

darken(amount: float) Self[source]#

使此颜色变暗(降低亮度)。

子类必须实现此方法。

Parameters:

amount (float) – 减少亮度的量(限制在零以上)

Returns:

颜色

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

通过从HSL颜色转换创建一个新颜色。

子类必须实现此方法。

Parameters:

value (HSL) – 从HSL转换的颜色

Returns:

颜色

abstract classmethod from_rgb(value: RGB) Self[来源]#

通过从RGB颜色转换创建一个新颜色。

子类必须实现此方法。

Parameters:

value (RGB) – 从RGB转换的颜色

Returns:

颜色

lighten(amount: float) Self[源代码]#

减轻(增加亮度)此颜色。

子类必须实现此方法。

Parameters:

amount (float) – 增加亮度的量(限制在零以上)

Returns:

颜色

abstract to_css() str[源代码]#

返回此颜色的CSS表示。

子类必须实现此方法。

Returns:

字符串

abstract to_hsl() HSL[源代码]#

通过从此颜色转换创建一个新的HSL颜色。

子类必须实现此方法。

Returns:

HSL

abstract to_rgb() RGB[源代码]#

通过从此颜色转换创建一个新的HSL颜色。

子类必须实现此方法。

Returns:

RGB

to_serializable(serializer: Serializer) Any[source]#

将此对象转换为可序列化的表示形式。

bokeh.colors.groups#

根据一般色调将CSS命名颜色组织成有用的组。

class black[source]#

CSS “黑色”颜色组,由https://www.w3schools.com/colors/colors_groups.asp定义

gainsboro
lightgray
silver
darkgray
gray
dimgray
lightslategray
slategray
darkslategray
black
class blue[源代码]#

CSS “蓝色” 颜色组,由 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 “棕色”颜色组,由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 “青色”颜色组,由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 “绿色”颜色组,由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 “橙色” 颜色组,由 https://www.w3schools.com/colors/colors_groups.asp 定义

orangered
tomato
coral
darkorange
orange
class pink[source]#

CSS “粉红色”颜色组,由https://www.w3schools.com/colors/colors_groups.asp定义

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

CSS “紫色”颜色组,由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 “红色”颜色组,由https://www.w3schools.com/colors/colors_groups.asp定义

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

CSS “白色”颜色组,由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 “黄色”颜色组,由https://www.w3schools.com/colors/colors_groups.asp定义

yellow
lightyellow
lemonchiffon
lightgoldenrodyellow
papayawhip
moccasin
peachpuff
palegoldenrod
khaki
darkkhaki
gold

bokeh.colors.named#

提供标准的147种CSS(X11)命名颜色。

aliceblue
antiquewhite
aqua
aquamarine
azure
beige
bisque
black
blanchedalmond
blue
blueviolet
brown
burlywood
cadetblue
chartreuse
chocolate
coral
cornflowerblue
cornsilk
crimson
cyan
darkblue
darkcyan
darkgoldenrod
darkgray
darkgreen
darkgrey
darkkhaki
darkmagenta
darkolivegreen
darkorange
darkorchid
darkred
darksalmon
darkseagreen
darkslateblue
darkslategray
darkslategrey
darkturquoise
darkviolet
deeppink
deepskyblue
dimgray
dimgrey
dodgerblue
firebrick
floralwhite
forestgreen
fuchsia
gainsboro
ghostwhite
gold
goldenrod
gray
green
greenyellow
grey
honeydew
hotpink
indianred
indigo
ivory
khaki
lavender
lavenderblush
lawngreen
lemonchiffon
lightblue
lightcoral
lightcyan
lightgoldenrodyellow
lightgray
lightgreen
lightgrey
lightpink
lightsalmon
lightseagreen
lightskyblue
lightslategray
lightslategrey
lightsteelblue
lightyellow
lime
limegreen
linen
magenta
maroon
mediumaquamarine
mediumblue
mediumorchid
mediumpurple
mediumseagreen
mediumslateblue
mediumspringgreen
mediumturquoise
mediumvioletred
midnightblue
mintcream
mistyrose
moccasin
navajowhite
navy
oldlace
olive
olivedrab
orange
orangered
orchid
palegoldenrod
palegreen
paleturquoise
palevioletred
papayawhip
peachpuff
peru
pink
plum
powderblue
purple
rebeccapurple
red
rosybrown
royalblue
saddlebrown
salmon
sandybrown
seagreen
seashell
sienna
silver
skyblue
slateblue
slategray
slategrey
snow
springgreen
steelblue
tan
teal
thistle
tomato
turquoise
violet
wheat
white
whitesmoke
yellow
yellowgreen