colour.utilities.filter_mapping#
- colour.utilities.filter_mapping(mapping: Mapping, names: str | Sequence[str]) dict[source]#
Filter the specified mapping with specified names.
- Parameters:
- Returns:
Filtered mapping containing only the specified elements.
- Return type:
Notes
If the mapping is a
colour.utilities.CanonicalMappinginstance, then the lower, slugified and canonical keys are also used for matching.To honour the filterers ordering, the return value is a
dictinstance.
Examples
>>> class Element: ... pass >>> mapping = { ... "Element A": Element(), ... "Element B": Element(), ... "Element C": Element(), ... "Not Element C": Element(), ... } >>> filter_mapping(mapping, "Element A") {'Element A': <colour.utilities.common.Element object at 0x...>}