GlowBit.py
Public Member Functions | List of all members
glowbit.colourFunctions Class Reference

Methods for transforming colours to 32-bit packed GlowBit colour values. More...

Inheritance diagram for glowbit.colourFunctions:
Inheritance graph
[legend]

Public Member Functions

def wheel (self, pos)
 Converts an integer "colour wheel position" to a packed 32-bit RGB GlowBit colour value. More...
 
def rgbColour (self, r, g, b)
 Converts the r, g, and b integer arguments to a packed 32-bit RGB GlowBit colour value. More...
 
def glowbitColour2RGB (self, colour)
 Converts a 32-bit GlowBit colour value to an (R,G,B) tuple. More...
 
def red (self)
 Returns the GlowBit colour value for pure red.
 
def green (self)
 Returns the GlowBit colour value for pure green.
 
def blue (self)
 Returns the GlowBit colour value for pure blue.
 
def yellow (self)
 Returns the GlowBit colour value for yellow.
 
def purple (self)
 Returns the GlowBit colour value for purple.
 
def cyan (self)
 Returns the GlowBit colour value for cyan.
 
def white (self)
 Returns the GlowBit colour value for white.
 
def black (self)
 Returns the GlowBit colour value for black.
 

Detailed Description

Methods for transforming colours to 32-bit packed GlowBit colour values.

A packed 32-bit GlowBit colour is an integer with 8-bits per colour channel data encoded in hexadecimal as follows:

0x00RRGGBB

where RR, GG, and BB are hexadecimal values (decimal [0,255]) and the most significant 8 bits are reserved and left as zero.

Member Function Documentation

◆ glowbitColour2RGB()

def glowbit.colourFunctions.glowbitColour2RGB (   self,
  colour 
)

Converts a 32-bit GlowBit colour value to an (R,G,B) tuple.

Parameters
colourA 32-bit GlowBit colour value
Returns
A tuple in the format (R,G,B) containing the RGB components of the colour parameter

◆ rgbColour()

def glowbit.colourFunctions.rgbColour (   self,
  r,
  g,
  b 
)

Converts the r, g, and b integer arguments to a packed 32-bit RGB GlowBit colour value.

All arguments are required as this is a micropython viper function.

Parameters
rThe red intensity, [0,255]
gThe green intensity, [0,255]
bThe blue intensity, [0,255]
Returns
Packed 32-bit GlowBit colour value

◆ wheel()

def glowbit.colourFunctions.wheel (   self,
  pos 
)

Converts an integer "colour wheel position" to a packed 32-bit RGB GlowBit colour value.

The "pos" argument is required as this is a micropython viper function.

Parameters
posColour wheel position [0,255] is mapped to a pure hue in the RGB colourspace. A value of 0 or 255 is mapped to pure red with a smooth red-yellow-green-blue-purple-magenta-red transion for other values.
Returns
32-bit integer GlowBit colour value

The documentation for this class was generated from the following file: