Get Type-Specific Palettes

Description

Get all palettes of a specific type.

Usage

hclpalettes.get_palettes(type_=None, exact=False)

Arguments

type_None, str
(Partial) Name of the palettes which should be returned. String matching is used; partial matches are allowed. If set to None (default) all palettes will be returned. Names have to match but are not case sensitive, defaults to None.
exactbool
If False (default) partial matching is used. If True, type_ must be an exact match (case sensitive).

Return

Returns a list containing defaultpalette objects objects.

Examples

# Initialize hclpalettes object
from colorspace import hclpalettes
hclpals = hclpalettes()
# Get all Diverging palettes
pals1 = hclpals.get_palettes("Diverging")
len(pals1)
36
# Get 'Advanced: Diverging' palettes, also includes
# 'Advanced: DivergingX' (partial match).
pals2 = hclpals.get_palettes("Advanced: Diverging")
len(pals2)
29
# Only get 'Advanced: Diverging' (exact match)
pals3 = hclpals.get_palettes("Advanced: Diverging", exact = True)
len(pals3)
11
pals3
[Palette Name: Blue-Red 3
         Type: Advanced: Diverging
         Inspired by: ...
          c1            50
          cmax          80
          fixup       True
          gui            1
          h1           255
          h2            12
          l1            20
          l2            97
          p1           1.0
          p2           1.3,
 Palette Name: Red-Green
         Type: Advanced: Diverging
         Inspired by: ...
          c1            60
          cmax          80
          fixup       True
          gui            1
          h1           340
          h2           128
          l1            30
          l2            97
          p1           0.8
          p2           1.5,
 Palette Name: Purple-Green
         Type: Advanced: Diverging
         Inspired by: ...
          c1            30
          cmax          65
          fixup       True
          gui            1
          h1           300
          h2           128
          l1            20
          l2            95
          p1           1.0
          p2           1.4,
 Palette Name: Purple-Brown
         Type: Advanced: Diverging
         Inspired by: ...
          c1            30
          cmax          70
          fixup       True
          gui            1
          h1           270
          h2            40
          l1            20
          l2            98
          p1           0.8
          p2           1.2,
 Palette Name: Green-Brown
         Type: Advanced: Diverging
         Inspired by: ...
          c1            40
          cmax          65
          fixup       True
          gui            1
          h1           180
          h2            55
          l1            25
          l2            97
          p1           0.8
          p2           1.4,
 Palette Name: Broc
         Type: Advanced: Diverging
         Inspired by: Crameri's sico palettes
          c1            30
          cmax          45
          fixup       True
          gui            0
          h1           240
          h2            85
          l1            15
          l2            98
          p1           0.9,
 Palette Name: Cork
         Type: Advanced: Diverging
         Inspired by: Crameri's sico palettes
          c1            30
          cmax          55
          fixup       True
          gui            1
          h1           245
          h2           125
          l1            15
          l2            95
          p1           0.9
          p2           1.1,
 Palette Name: Vik
         Type: Advanced: Diverging
         Inspired by: Crameri's sico palettes
          c1            45
          cmax          65
          fixup       True
          gui            0
          h1           240
          h2            55
          l1            15
          l2            95
          p1           0.8
          p2           1.1,
 Palette Name: Berlin
         Type: Advanced: Diverging
         Inspired by: Crameri's sico palettes
          c1            60
          cmax          80
          fixup       True
          gui            1
          h1           240
          h2            15
          l1            75
          l2             5
          p1           1.2
          p2           1.5,
 Palette Name: Lisbon
         Type: Advanced: Diverging
         Inspired by: Crameri's sico palettes
          c1            30
          cmax          45
          fixup       True
          gui            1
          h1           240
          h2            85
          l1            98
          l2             8
          p1           1.0,
 Palette Name: Tofino
         Type: Advanced: Diverging
         Inspired by: Crameri's sico palettes
          c1            45
          cmax          55
          fixup       True
          gui            1
          h1           260
          h2           120
          l1            90
          l2             5
          p1           0.8
          p2           1.0]

Raises

  • TypeError: If type_ is not str or None.
  • TypeError: If exact is not bool.
  • ValueError: If no matching palette is found.