mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-08 09:35:15 +00:00
Color: Add to_grayscale() and darkened() helpers.
This commit is contained in:
@@ -72,6 +72,17 @@ public:
|
||||
return Color(r, g, b, a);
|
||||
}
|
||||
|
||||
Color to_grayscale() const
|
||||
{
|
||||
int gray = (red() + green() + blue()) / 3;
|
||||
return Color(gray, gray, gray, alpha());
|
||||
}
|
||||
|
||||
Color darkened() const
|
||||
{
|
||||
return Color(red() * 0.8, green() * 0.8, blue() * 0.8, alpha());
|
||||
}
|
||||
|
||||
RGBA32 value() const { return m_value; }
|
||||
|
||||
String to_string() const;
|
||||
|
||||
Reference in New Issue
Block a user