mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +00:00
Color: Add to_grayscale() and darkened() helpers.
This commit is contained in:
parent
cfab81a961
commit
a74f3615ac
1 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue