mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-04 08:36:12 +00:00
LibGfx: Add Color::to_string_without_alpha()
This simply returns an "#rrggbb" string and ignores the alpha value.
This commit is contained in:
parent
bc305a16ae
commit
17e76b4760
Notes:
sideshowbarker
2024-07-19 07:11:29 +09:00
Author: https://github.com/awesomekling
Commit: 17e76b4760
2 changed files with 7 additions and 1 deletions
|
@ -119,7 +119,12 @@ Color::Color(NamedColor named)
|
|||
|
||||
String Color::to_string() const
|
||||
{
|
||||
return String::format("#%b%b%b%b", red(), green(), blue(), alpha());
|
||||
return String::format("#%02x%02x%02x%02x", red(), green(), blue(), alpha());
|
||||
}
|
||||
|
||||
String Color::to_string_without_alpha() const
|
||||
{
|
||||
return String::format("#%02x%02x%02x", red(), green(), blue());
|
||||
}
|
||||
|
||||
static Optional<Color> parse_rgb_color(const StringView& string)
|
||||
|
|
|
@ -170,6 +170,7 @@ public:
|
|||
}
|
||||
|
||||
String to_string() const;
|
||||
String to_string_without_alpha() const;
|
||||
static Optional<Color> from_string(const StringView&);
|
||||
|
||||
HSV to_hsv() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue