pyvista.Color.name

Contents

pyvista.Color.name#

property Color.name: str | None[source]#

Get the color name.

The name is always formatted as a lower case string without any delimiters.

See Named Colors for a list of supported colors.

Returns:
str | None

The color name, in case this color has a name; otherwise None.

Examples

Create a dark blue color with half opacity.

>>> import pyvista as pv
>>> c = pv.Color('darkblue', default_opacity=0.5)
>>> c
Color(name='darkblue', hex='#00008b80', opacity=128)

When creating a new Color, the name may be delimited with a space, hyphen, underscore, or written as a single word.

>>> c = pv.Color('dark blue', default_opacity=0.5)

Upper-case letters are also supported.

>>> c = pv.Color('DarkBlue', default_opacity=0.5)

However, the name is always standardized as a single lower-case word.

>>> c
Color(name='darkblue', hex='#00008b80', opacity=128)