Ticket #1009 (closed enhancement: invalid)
Color: Getting perceived brightness of a color
| Reported by: | blixt | Owned by: | |
|---|---|---|---|
| Type: | enhancement | Priority: | trivial |
| Milestone: | Mootools version 1.2 | Component: | Plugins |
| Keywords: | plugins color brightness grayscale greyscale | Cc: |
Description
Being able to get the perceived brightness of a color would be a useful addition to the Color class. With your HSV (HSB) functions you can get value (brightness) and set saturation to 0, but neither of those will be the "natural" gray color (and that's correct for HSV.)
To describe what I mean by "perceived brightness", green is much brighter than red, and blue is darker than red. Just averaging red, green and blue would not yield a gray color with the same perceived brightness as the original color.
A common formula for calculating the grayscale color of an RGB color is r * 0.3 + g * 0.59 + b * 0.11 .