From d72ad663cd9f8c96d4440a8dca71fc7592a4bade Mon Sep 17 00:00:00 2001 From: Orange Date: Sat, 29 Mar 2025 05:41:55 +0300 Subject: [PATCH] added new methods --- include/omath/color.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/omath/color.hpp b/include/omath/color.hpp index bafefc3..c82c19d 100644 --- a/include/omath/color.hpp +++ b/include/omath/color.hpp @@ -118,7 +118,29 @@ namespace omath { Clamp(0.f, 1.f); } + consteval void SetHue(const float hue) + { + auto hsv = ToHSV(); + hsv.hue = hue; + *this = FromHSV(hsv); + } + + consteval void SetSaturation(const float saturation) + { + auto hsv = ToHSV(); + hsv.saturation = saturation; + + *this = FromHSV(hsv); + } + + consteval void SetValue(const float value) + { + auto hsv = ToHSV(); + hsv.value = value; + + *this = FromHSV(hsv); + } [[nodiscard]] constexpr Color Blend(const Color& other, float ratio) const {