colour.utilities.as_bool#

colour.utilities.as_bool(a: str) bool[source]#

Convert given string to bool.

The following string values evaluate to True: “1”, “On”, and “True”.

Parameters:

a (str) – String to convert to bool.

Returns:

Whether the given string is True.

Return type:

bool

Examples

>>> as_bool("1")
True
>>> as_bool("On")
True
>>> as_bool("True")
True
>>> as_bool("0")
False
>>> as_bool("Off")
False
>>> as_bool("False")
False