LibGfx: Add Color::from_utf16_string()

This commit is contained in:
Jelle Raaijmakers 2025-07-22 17:25:56 +02:00 committed by Tim Flynn
commit a9862d60bf
Notes: github-actions[bot] 2025-07-24 11:20:13 +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/Utf16View.h>
#include <AK/Vector.h>
#include <LibGfx/Color.h>
#include <LibIPC/Decoder.h>
@ -367,6 +368,11 @@ Optional<Color> Color::from_string(StringView string)
return {};
}
Optional<Color> Color::from_utf16_string(Utf16View const& string)
{
return from_string(string.to_utf8_but_should_be_ported_to_utf16());
}
Vector<Color> Color::shades(u32 steps, float max) const
{
float shade = 1.f;

View file

@ -491,6 +491,7 @@ public:
ByteString to_byte_string() const;
ByteString to_byte_string_without_alpha() const;
static Optional<Color> from_string(StringView);
static Optional<Color> from_utf16_string(Utf16View const&);
static Optional<Color> from_named_css_color_string(StringView);
constexpr HSV to_hsv() const