From a9862d60bf5730bbf80762f1195adcf5800e6bbc Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Tue, 22 Jul 2025 17:25:56 +0200 Subject: [PATCH] LibGfx: Add Color::from_utf16_string() --- Libraries/LibGfx/Color.cpp | 6 ++++++ Libraries/LibGfx/Color.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Libraries/LibGfx/Color.cpp b/Libraries/LibGfx/Color.cpp index 1837ddb711c..28c73e0a0fa 100644 --- a/Libraries/LibGfx/Color.cpp +++ b/Libraries/LibGfx/Color.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -367,6 +368,11 @@ Optional Color::from_string(StringView string) return {}; } +Optional Color::from_utf16_string(Utf16View const& string) +{ + return from_string(string.to_utf8_but_should_be_ported_to_utf16()); +} + Vector Color::shades(u32 steps, float max) const { float shade = 1.f; diff --git a/Libraries/LibGfx/Color.h b/Libraries/LibGfx/Color.h index 45fe061cfb8..3d2d9980bb0 100644 --- a/Libraries/LibGfx/Color.h +++ b/Libraries/LibGfx/Color.h @@ -491,6 +491,7 @@ public: ByteString to_byte_string() const; ByteString to_byte_string_without_alpha() const; static Optional from_string(StringView); + static Optional from_utf16_string(Utf16View const&); static Optional from_named_css_color_string(StringView); constexpr HSV to_hsv() const