brown.utils.color

classes

A general purpose Color class

Set properties from an #rrggbb hex string

Args: hex_value (str): A hexadecimal color string with 6 characters (or 7 if including a leading "#")

Returns: None

Set properties from an #rrggbb hex string and a 0-255 alpha value

Args: hex_value (str): A hexadecimal color string with 6 characters (or 7 if including a leading "#") alpha (int): A 0-255 alpha channel value

Returns: None

Set properties from three 0-255 red, green, and blue values

Args: red (int): A 0-255 red channel value green (int): A 0-255 green channel value blue (int): A 0-255 blue channel value

Returns: None

Set properties from four 0-255 red, green, blue, and alpha values

Args: red (int): A 0-255 red channel value green (int): A 0-255 green channel value blue (int): A 0-255 blue channel value alpha (int): A 0-255 alpha channel value

Returns: None

__init__ (*args) permalink view source

Valid signatures:

  • Color(red, green, blue)
  • Color(red, green, blue, alpha)
  • Color(hex_string)
  • Color(hex_string, alpha)
Currently entering these values as keyword arguments is not supported.

properties

red: int The 0-255 value of the red color channel permalink view source

green: int The 0-255 value of the green color channel permalink view source

blue: int The 0-255 value of the blue color channel permalink view source

alpha: int The 0-255 value of the alpha color channel permalink view source

methods

__eq__ (other) permalink view source

Two Colors are considered equal if all of their properties are.

__hash__ () permalink view source

A Color's hash is a hash of its __repr__().

Colors with equal properties will have the same hash.