---
title: "Colour"
description: "API documentation for Colour"
url: https://developer.disguise.one/python-api/docs/colour/
---

# Colour

A floating-point RGBA representation of a Colour

This class does not hold any colour space information, therefore the precise meaning of the values will depend on the context in which it is used.

See also: [Utility Guide](/plugins/guides/utility)

Base class: _\_BlipValue_

## Properties

#### **a** : _float_

The alpha (transparency) component of the colour.  
Between 0-1, 0 is fully transparent, 1 is fully opaque.

_UserName: A_

#### **b** : _float_

The blue component of the colour.  
Between 0-1 if an sRGB value, may be outside this range otherwise.

_UserName: B_

#### **g** : _float_

The green component of the colour.  
Between 0-1 if an sRGB value, may be outside this range otherwise.

_UserName: G_

#### **r** : _float_

The red component of the colour.  
Between 0-1 if an sRGB value, may be outside this range otherwise.

_UserName: R_

## Variables

#### **black** : _[Colour](/python-api/docs/colour#colour)_

Full black sRGB colour

#### **blackZeroAlpha** : _[Colour](/python-api/docs/colour#colour)_

Full black sRGB colour, with zero alpha

#### **blue** : _[Colour](/python-api/docs/colour#colour)_

Blue sRGB colour

#### **caramel** : _[Colour](/python-api/docs/colour#colour)_

Caramel sRGB colour

#### **cyan** : _[Colour](/python-api/docs/colour#colour)_

Cyan sRGB colour

#### **darkGrey** : _[Colour](/python-api/docs/colour#colour)_

Dark grey sRGB colour

#### **green** : _[Colour](/python-api/docs/colour#colour)_

Green sRGB colour

#### **grey** : _[Colour](/python-api/docs/colour#colour)_

Mid grey sRGB colour

#### **lightGrey** : _[Colour](/python-api/docs/colour#colour)_

Light grey sRGB colour

#### **lime** : _[Colour](/python-api/docs/colour#colour)_

Lime sRGB colour

#### **magenta** : _[Colour](/python-api/docs/colour#colour)_

Magenta sRGB colour

#### **orange** : _[Colour](/python-api/docs/colour#colour)_

Orange sRGB colour

#### **pink** : _[Colour](/python-api/docs/colour#colour)_

Pink sRGB colour

#### **red** : _[Colour](/python-api/docs/colour#colour)_

Red sRGB colour

#### **transparent** : _[Colour](/python-api/docs/colour#colour)_

Fully transparent sRGB colour

#### **turquoise** : _[Colour](/python-api/docs/colour#colour)_

Turquoise sRGB colour

#### **white** : _[Colour](/python-api/docs/colour#colour)_

Full white sRGB colour

#### **whiteZeroAlpha** : _[Colour](/python-api/docs/colour#colour)_

Full white sRGB colour, with zero alpha

#### **yellow** : _[Colour](/python-api/docs/colour#colour)_

Yellow sRGB colour

## Constructors

#### **\_\_init\_\_**(self)

#### **\_\_init\_\_**(self, other: _[Colour](/python-api/docs/colour#colour)_)

Copy constructor for Colour

#### **\_\_init\_\_**(self, rgb: _[Colour](/python-api/docs/colour#colour)_, a: _float_)

#### **\_\_init\_\_**(self, r: _float_, g: _float_, b: _float_)

#### **\_\_init\_\_**(self, r: _float_, g: _float_, b: _float_, a: _float_)

#### **\_\_init\_\_**(self, col: _[Col](/python-api/docs/col#col)_)

#### **\_\_init\_\_**(self, hdr: _[HDRColour](/python-api/docs/hdrcolour#hdrcolour)_)

## Methods

#### **mix**(self, c: _[Colour](/python-api/docs/colour#colour) | [Col](/python-api/docs/col#col) | [HDRColour](/python-api/docs/hdrcolour#hdrcolour)_, f: _float_) -> _[Colour](/python-api/docs/colour#colour)_

Mixes two colours together.

Performs a linear interpolation between this and another colour based on a mix factor f.

**Parameters**:

-   c: The colour to mix with.
-   f: The factor of the mix, from 0-1. 0 returns this colour, 1 returns the other colour c.

**Returns** A new colour that is a mix between this and the given colour.

#### **toCol**(self) -> _[Col](/python-api/docs/col#col)_

Converts the colour to an 8-bit Col structure.

**Returns** An 8-bit Col representation of this colour.

#### **toHSL**(self) -> _[Vec](/python-api/docs/vec#vec)_

Convert the colour to HSL (Hue, Saturation, Luminance) format.

**Returns** A vector containing the hue, saturation, and luminance values of the colour.

#### **toNormalisedColour**(self) -> _[Colour](/python-api/docs/colour#colour)_

Converts the colour to normalised float form.

**Returns** A new Colour object with RGBA components limited to the range 0-1.

#### **toVec**(self) -> _[Vec](/python-api/docs/vec#vec)_

Converts the colour object to a vector.

**Returns** A vector containing the RGB components of this colour.

## Static Methods

#### **fromHSL**(h: _float_, s: _float_, l: _float_) -> _[Colour](/python-api/docs/colour#colour)_

## Special Methods

#### **\_\_add\_\_**(self, c: _[Colour](/python-api/docs/colour#colour) | [Col](/python-api/docs/col#col) | [HDRColour](/python-api/docs/hdrcolour#hdrcolour)_) -> _[Colour](/python-api/docs/colour#colour)_

Adds two colours

Performs a component-wise addition of the two colours, including alpha. Values above one are saturated at one.

**Parameters**:

-   c: The colour to add

**Returns** The resulting colour

#### **\_\_eq\_\_**(self, c: _[Colour](/python-api/docs/colour#colour) | [Col](/python-api/docs/col#col) | [HDRColour](/python-api/docs/hdrcolour#hdrcolour)_) -> _bool_

Equality comparison operator for colours.

**Parameters**:

-   c: The other colour to compare with.

**Returns** True if all RGBA components of the colours are equal, false otherwise.

#### **\_\_mul\_\_**(self, x) -> _Any_

Multiply the elements of the colour by a value

**Parameters**:

-   x: A float or integer multiplier

**Returns** The colour with its elements multiplied by x

#### **\_\_ne\_\_**(self, c: _[Colour](/python-api/docs/colour#colour) | [Col](/python-api/docs/col#col) | [HDRColour](/python-api/docs/hdrcolour#hdrcolour)_) -> _bool_

Checks if two colours are not equal.

**Parameters**:

-   c: The other colour to compare with.

**Returns** True if any of the RGBA components of the colours are not equal, false otherwise.

#### **\_\_repr\_\_**(self) -> _Any_

String representation of the colour

#### **\_\_rmul\_\_**(self, x) -> _Any_

Multiply the elements of the colour by a value

**Parameters**:

-   x: A float or integer multiplier

**Returns** The colour with its elements multiplied by x

#### **\_\_sub\_\_**(self, c: _[Colour](/python-api/docs/colour#colour) | [Col](/python-api/docs/col#col) | [HDRColour](/python-api/docs/hdrcolour#hdrcolour)_) -> _[Colour](/python-api/docs/colour#colour)_

Subtracts another colour from this one.

Performs a component-wise subtraction of the given colour from this one. Values below zero are saturated at zero.

**Parameters**:

-   c: The colour to subtract from this one.

**Returns** The resulting colour.
