From 07dc7064f83f2c127588f4280ddb2996a49ebef3 Mon Sep 17 00:00:00 2001 From: apio Date: Thu, 3 Aug 2023 17:52:19 +0200 Subject: [PATCH] libui: Add getters for separate color values --- libui/include/ui/Color.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/libui/include/ui/Color.h b/libui/include/ui/Color.h index 39d8db91..4fbf29c2 100644 --- a/libui/include/ui/Color.h +++ b/libui/include/ui/Color.h @@ -13,6 +13,46 @@ namespace ui u8 colors[4]; }; + /** + * @brief Return the blue value of this color. + * + * @return constexpr u8 The blue value. + */ + constexpr u8 red() const + { + return colors[2]; + } + + /** + * @brief Return the green value of this color. + * + * @return constexpr u8 The green value. + */ + constexpr u8 green() const + { + return colors[1]; + } + + /** + * @brief Return the blue value of this color. + * + * @return constexpr u8 The blue value. + */ + constexpr u8 blue() const + { + return colors[0]; + } + + /** + * @brief Return the alpha value of this color. + * + * @return constexpr u8 The alpha value. + */ + constexpr u8 alpha() const + { + return colors[3]; + } + /** * @brief Construct a new color from a 32-bit ARGB integer. *