colour.utilities.as_bool#

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

Convert the specified string to a boolean value.

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

Parameters:

a (str) – String to convert to boolean.

Returns:

Boolean representation of the specified string.

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