Skip to content

Commit 3911c05

Browse files
committed
Color macros
1 parent e7f1d3b commit 3911c05

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

OS/Framework/Color/Color.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,13 @@ Color Color::Crossfade(Color color1, Color color2, Fract16 ratio) {
111111
uint8_t newB = (color1.B * (255 - r) + color2.B * r) >> 8;
112112
return Color(newR, newG, newB);
113113
}
114+
115+
// Predefined color constants
116+
const Color Color::White = Color(255, 255, 255);
117+
const Color Color::Black = Color(0, 0, 0);
118+
const Color Color::Red = Color(255, 0, 0);
119+
const Color Color::Green = Color(0, 255, 0);
120+
const Color Color::Blue = Color(0, 0, 255);
121+
const Color Color::Yellow = Color(255, 255, 0);
122+
const Color Color::Cyan = Color(0, 255, 255);
123+
const Color Color::Magenta = Color(255, 0, 255);

OS/Framework/Color/Color.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ class Color {
3434

3535
static Color Crossfade(Color color1, Color color2, Fract16 ratio);
3636

37+
// Predefined colors
38+
static const Color White;
39+
static const Color Black;
40+
static const Color Red;
41+
static const Color Green;
42+
static const Color Blue;
43+
static const Color Yellow;
44+
static const Color Cyan;
45+
static const Color Magenta;
46+
3747
// Equality comparison operators
3848
bool operator==(const Color& other) const {
3949
return R == other.R && G == other.G && B == other.B && W == other.W;

0 commit comments

Comments
 (0)