LibGfx: Implement a UTF-16 Color stringifier

This commit is contained in:
Timothy Flynn 2025-07-26 08:02:52 -04:00 committed by Andreas Kling
commit f3146d3320
Notes: github-actions[bot] 2025-07-28 10:26:49 +00:00
2 changed files with 7 additions and 0 deletions

View file

@ -11,6 +11,7 @@
#include <AK/Optional.h>
#include <AK/StringConversions.h>
#include <AK/Swift.h>
#include <AK/Utf16String.h>
#include <AK/Utf16View.h>
#include <AK/Vector.h>
#include <LibGfx/Color.h>
@ -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();

View file

@ -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;