Color.name#
- property Color.name: str | None[source]#
Get the color name.
The name is always formatted as a lower case string with underscore delimiters between words.
See Named Colors for a list of supported colors.
Changed in version 0.48: Multi-word names are now delimited with
_e.g.'alice_blue'instead of'aliceblue'.
Examples#
Download Python source code | Download Jupyter notebook
Create a dark blue color with half opacity.
>>> import pyvista as pv
>>> c = pv.Color('darkblue', default_opacity=0.5)
>>> c
Color(name='dark_blue', 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 lower-case with an underscore between words.
>>> c
Color(name='dark_blue', hex='#00008b80', opacity=128)