diff --git a/src/nostalgia/core/color.hpp b/src/nostalgia/core/color.hpp index 7e28a8f2..12f636d3 100644 --- a/src/nostalgia/core/color.hpp +++ b/src/nostalgia/core/color.hpp @@ -91,6 +91,22 @@ constexpr uint8_t blue32(Color32 c) noexcept { } +[[nodiscard]] +constexpr float redf(Color16 c) noexcept { + return static_cast(red16(c)) / 31.f; +} + +[[nodiscard]] +constexpr float greenf(Color16 c) noexcept { + return static_cast(green16(c)) / 31.f; +} + +[[nodiscard]] +constexpr float bluef(Color16 c) noexcept { + return static_cast(blue16(c)) / 31.f; +} + + [[nodiscard]] constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b) noexcept { return r | (g << 5) | (b << 10);