colour.utilities.Lookup

class colour.utilities.Lookup[source]

Bases: dict

Extends dict type to provide a lookup by value(s).

keys_from_value()[source]
first_key_from_value()[source]

References

[Mana]

Examples

>>> person = Lookup(first_name='John', last_name='Doe', gender='male')
>>> person.first_key_from_value('John')
'first_name'
>>> persons = Lookup(John='Doe', Jane='Doe', Luke='Skywalker')
>>> sorted(persons.keys_from_value('Doe'))
['Jane', 'John']
first_key_from_value(value)[source]

Gets the first key with given value.

Parameters

value (object) – Value.

Returns

Key.

Return type

object

keys_from_value(value)[source]

Gets the keys with given value.

Parameters

value (object) – Value.

Returns

Keys.

Return type

object