from_name method

from_name(name)

Creates a color from the specified name of a predefined color.
The lookup is case-insensitive and ignores underscores and spaces: "LightBlue", "lightblue" and "light_blue" all resolve to Color.light_blue. See the Color class page for the list of predefined colors.

Returns

The named color.

@staticmethod
def from_name(name):
    ...
ParameterTypeDescription
namestrA string that is the name of a predefined color.

Exceptions

ExceptionDescription
ValueErrorThe name is not a name of a predefined color.
TypeErrorThe name is not a string.

See Also