diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-04-15 10:09:25 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-04-16 10:02:46 +0200 |
commit | e197c7b29d8814d098bd53e9e7efd97c70f8de5f (patch) | |
tree | b91bd66bb2eb27d2b1dc07637b66bcdd34951b93 /resources/transform.go | |
parent | 74e9129568e3b506a34205f11d024400f833a907 (diff) | |
download | hugo-e197c7b29d8814d098bd53e9e7efd97c70f8de5f.tar.gz hugo-e197c7b29d8814d098bd53e9e7efd97c70f8de5f.zip |
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
Diffstat (limited to 'resources/transform.go')
-rw-r--r-- | resources/transform.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/resources/transform.go b/resources/transform.go index 39a8aaccc..d9084b178 100644 --- a/resources/transform.go +++ b/resources/transform.go @@ -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() } |