Rename Custom Palette

Description

Allows to set, remplace, or remove the name of a palette.

Usage

palette.rename(name)

Arguments

nameNone, str
new name for the palette.

Examples

from colorspace import palette
# Starting from an unnamed palette
pal = palette(["#11C638", "#E2E2E2", "#EF9708"])
pal.name() # Returns None
# Naming the palette
pal.rename("Custom palette")
pal.name()
'Custom palette'
# Rename
pal.rename("Modified palette name")
pal.name()
'Modified palette name'
# Unname (replace current name with None)
pal.rename(None)
pal.name() # Returns None

Raises

  • ValueError: If input 'name' is not of type str.