From f3146d332028c47cec8b78c86e595067d96fdb98 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 26 Jul 2025 08:02:52 -0400 Subject: [PATCH] LibGfx: Implement a UTF-16 Color stringifier --- 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 28c73e0a0fa..fb7955d68c0 100644 --- a/Libraries/LibGfx/Color.cpp +++ b/Libraries/LibGfx/Color.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -54,6 +55,11 @@ String Color::to_string_without_alpha() const return MUST(String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue())); } +Utf16String Color::to_utf16_string_without_alpha() const +{ + return Utf16String::formatted("#{:02x}{:02x}{:02x}", red(), green(), blue()); +} + ByteString Color::to_byte_string() const { return to_string().to_byte_string(); diff --git a/Libraries/LibGfx/Color.h b/Libraries/LibGfx/Color.h index 3d2d9980bb0..624152fddae 100644 --- a/Libraries/LibGfx/Color.h +++ b/Libraries/LibGfx/Color.h @@ -487,6 +487,7 @@ public: [[nodiscard]] String to_string(HTMLCompatibleSerialization = HTMLCompatibleSerialization::No) const; String to_string_without_alpha() const; + Utf16String to_utf16_string_without_alpha() const; ByteString to_byte_string() const; ByteString to_byte_string_without_alpha() const;