mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 06:00:25 +03:00
Add Luminance to Color
To sort an image's colors from darkest to lightest, you can then do: ```handlebars {{ {{ $colorsByLuminance := sort $image.Colors "Luminance" }} ``` This uses the formula defined here: https://www.w3.org/TR/WCAG21/#dfn-relative-luminance Fixes #10450
This commit is contained in:
parent
74e9129568
commit
e197c7b29d
12 changed files with 204 additions and 39 deletions
|
@ -263,7 +263,7 @@ func (r *resourceAdapter) Exif() *exif.ExifInfo {
|
|||
return r.getImageOps().Exif()
|
||||
}
|
||||
|
||||
func (r *resourceAdapter) Colors() ([]string, error) {
|
||||
func (r *resourceAdapter) Colors() ([]images.Color, error) {
|
||||
return r.getImageOps().Colors()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue