![]() |
Max OS 0.3
|
Stores the red, green, blue and alpha values of a colour. Can be parsed from a hex string, an ANSI string or a ConsoleColour. More...
#include <colour.h>
Public Member Functions | |
| Colour (ConsoleColour colour) | |
| Constructs a Colour from the the console equivalent. | |
| Colour (string string) | |
| Constructs a Colour from a string. If it starts with a '#' will be treated as a hex code otherwise, a ansi code. | |
| Colour (uint8_t red, uint8_t green, uint8_t blue) | |
| Constructs a Colour from a set of RGB values. Alpha defaults to 255. | |
| Colour (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) | |
| Constructs a Colour from a set of RGBA values. | |
| ConsoleColour | to_console_colour () const |
| Converts the colour to a console colour. | |
Public Attributes | |
| uint8_t | red { 0 } |
| The amount of red 0-255. | |
| uint8_t | green { 0 } |
| The amount of green 0-255. | |
| uint8_t | blue { 0 } |
| The amount of blue 0-255. | |
| uint8_t | alpha { 0 } |
| The amount of alpha 0-255 (0 is visible, 255 is invisible) todo: confirm. | |
Stores the red, green, blue and alpha values of a colour. Can be parsed from a hex string, an ANSI string or a ConsoleColour.
|
explicit |
Constructs a Colour from the the console equivalent.
| colour | The console colour to convert |
Definition at line 21 of file colour.cpp.
|
explicit |
Constructs a Colour from a string. If it starts with a '#' will be treated as a hex code otherwise, a ansi code.
| string | The string to parse, must be either a hex code or an ANSI escape code |
Definition at line 30 of file colour.cpp.
Constructs a Colour from a set of RGB values. Alpha defaults to 255.
| red | The amount of red 0-255 |
| green | The amount of green 0-255 |
| blue | The amount of blue 0-255 |
Definition at line 46 of file colour.cpp.
Constructs a Colour from a set of RGBA values.
| red | The amount of red 0-255 |
| green | The amount of green 0-255 |
| blue | The amount of blue 0-255 |
| alpha | The amount of alpha 0-255 |
Definition at line 62 of file colour.cpp.
| ConsoleColour Colour::to_console_colour | ( | ) | const |
Converts the colour to a console colour.
Definition at line 261 of file colour.cpp.
References blue, green, and red.
Referenced by MaxOS::drivers::console::VESABootConsole::put_character().
| uint8_t MaxOS::common::Colour::alpha { 0 } |
The amount of alpha 0-255 (0 is visible, 255 is invisible) todo: confirm.
Definition at line 102 of file colour.h.
Referenced by MaxOS::common::GraphicsContext::colour_to_int().
| uint8_t MaxOS::common::Colour::blue { 0 } |
The amount of blue 0-255.
Definition at line 101 of file colour.h.
Referenced by MaxOS::common::GraphicsContext::colour_to_int(), MaxOS::common::GraphicsContext::invert_pixel(), and to_console_colour().
| uint8_t MaxOS::common::Colour::green { 0 } |
The amount of green 0-255.
Definition at line 100 of file colour.h.
Referenced by MaxOS::common::GraphicsContext::colour_to_int(), MaxOS::common::GraphicsContext::invert_pixel(), and to_console_colour().
| uint8_t MaxOS::common::Colour::red { 0 } |
The amount of red 0-255.
Definition at line 99 of file colour.h.
Referenced by MaxOS::common::GraphicsContext::colour_to_int(), MaxOS::common::GraphicsContext::invert_pixel(), and to_console_colour().