gewel.color.BaseColor

class gewel.color.BaseColor[source]

Bases: abc.ABC

The abstract base class for colors.

Methods

is_transparent

Indicates whether the color is transparent or not, i.e. whether its alpha is certain to be zero.

tuple

Construct a (red, green, blue, alpha) tuple representing the color.

abstract is_transparent() bool[source]

Indicates whether the color is transparent or not, i.e. whether its alpha is certain to be zero. Checking this may be useful in checking whether something needs to be rendered or not. If the color it would be rendered is transparent then it does not.

Returns

True if the color is transparent. False otherwise.

Return type

bool

abstract tuple(t: float, alpha_multiplier: Union[float, Tvf, PyTvf] = 1.0) Tuple[float, float, float, float][source]

Construct a (red, green, blue, alpha) tuple representing the color. The red, green, and blue components are determined by the color. The alpha component may be affected by the value of the alpha_multiplier parameter.

Parameters
  • t – The time for which we want the tuple.

  • alpha_multiplier – A multiplicative factor for the alpha. The value should be between 0.0 and 1.0. It will be multiplied by the alpha of the color to produce the fourth element of the resulting tuple. Passing in 0.0 will produce alpha transparent result (alpha = 0.0) while passing in the default value of 1.0 will leave the alpha of the color unchanged.

Returns

A four element tuple, (red, green, blue, alpha) of color components for red, green, blue, and alpha (opacity). All are in the range [0.0, 1.0].

Return type

tuple