Max OS 0.3
Loading...
Searching...
No Matches
colour.h File Reference

Defines a Colour class for representing colours in RGBA format, along with ANSI and console colour enumerations. More...

#include <common/string.h>
#include <cstdint>

Go to the source code of this file.

Classes

class  MaxOS::common::Colour
 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...
 

Enumerations

enum  MaxOS::common::ANSIColour {
  FG_Black , FG_Red , FG_Green , FG_Yellow ,
  FG_Blue , FG_Magenta , FG_Cyan , FG_White ,
  BG_Black , BG_Red , BG_Green , BG_Yellow ,
  BG_Blue , BG_Magenta , BG_Cyan , BG_White ,
  Reset
}
 Enumeration of ANSI colour codes for foreground and background colours. More...
 
enum class  MaxOS::common::ConsoleColour {
  Uninitialised = 0xFF , Black = 0x00 , Blue = 0x01 , Green = 0x02 ,
  Cyan = 0x03 , Red = 0x04 , Magenta = 0x05 , Brown = 0x06 ,
  LightGrey = 0x07 , DarkGrey = 0x08 , LightBlue = 0x09 , LightGreen = 0x0A ,
  LightCyan = 0x0B , LightRed = 0x0C , LightMagenta = 0x0D , Yellow = 0x0E ,
  White = 0x0F
}
 Enumeration of console colour codes. More...
 

Variables

const char *const MaxOS::common::ANSI_COLOURS []
 ANSI Colour Codes.
 

Detailed Description

Defines a Colour class for representing colours in RGBA format, along with ANSI and console colour enumerations.

Date
30th March 2023
Author
Max Tyson

Definition in file colour.h.

Enumeration Type Documentation

◆ ANSIColour

Enumeration of ANSI colour codes for foreground and background colours.

Definition at line 43 of file colour.h.

43 {
44 FG_Black,
45 FG_Red,
46 FG_Green,
47 FG_Yellow,
48 FG_Blue,
49 FG_Magenta,
50 FG_Cyan,
51 FG_White,
52 BG_Black,
53 BG_Red,
54 BG_Green,
55 BG_Yellow,
56 BG_Blue,
57 BG_Magenta,
58 BG_Cyan,
59 BG_White,
60 Reset,
61 };

◆ ConsoleColour

enum class MaxOS::common::ConsoleColour
strong

Enumeration of console colour codes.

Definition at line 67 of file colour.h.

67 {
68 Uninitialised = 0xFF,
69 Black = 0x00,
70 Blue = 0x01,
71 Green = 0x02,
72 Cyan = 0x03,
73 Red = 0x04,
74 Magenta = 0x05,
75 Brown = 0x06,
76 LightGrey = 0x07,
77 DarkGrey = 0x08,
78 LightBlue = 0x09,
79 LightGreen = 0x0A,
80 LightCyan = 0x0B,
81 LightRed = 0x0C,
82 LightMagenta = 0x0D,
83 Yellow = 0x0E,
84 White = 0x0F
85 };

Variable Documentation

◆ ANSI_COLOURS

const char* const MaxOS::common::ANSI_COLOURS[]
Initial value:
= {
"\033[0;30m",
"\033[0;31m",
"\033[0;32m",
"\033[0;33m",
"\033[0;34m",
"\033[0;35m",
"\033[0;36m",
"\033[0;37m",
"\033[0;40m",
"\033[0;41m",
"\033[0;42m",
"\033[0;43m",
"\033[0;44m",
"\033[0;45m",
"\033[0;46m",
"\033[0;47m",
"\033[0m"
}

ANSI Colour Codes.

Definition at line 19 of file colour.h.

19 {
20 "\033[0;30m", // FG Black
21 "\033[0;31m", // FG Red
22 "\033[0;32m", // FG Green
23 "\033[0;33m", // FG Yellow
24 "\033[0;34m", // FG Blue
25 "\033[0;35m", // FG Magenta
26 "\033[0;36m", // FG Cyan
27 "\033[0;37m", // FG White
28 "\033[0;40m", // BG Black
29 "\033[0;41m", // BG Red
30 "\033[0;42m", // BG Green
31 "\033[0;43m", // BG Yellow
32 "\033[0;44m", // BG Blue
33 "\033[0;45m", // BG Magenta
34 "\033[0;46m", // BG Cyan
35 "\033[0;47m", // BG White
36 "\033[0m" // Reset
37 };

Referenced by MaxOS::drivers::console::VESABootConsole::finish(), and MaxOS::Logger::set_log_level().