mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02: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:
@@ -132,7 +132,7 @@ func newImageConfig(action string, width, height, quality, rotate int, filter, a
|
||||
c.qualitySetForImage = quality != 75
|
||||
c.Rotate = rotate
|
||||
c.BgColorStr = bgColor
|
||||
c.BgColor, _ = hexStringToColor(bgColor)
|
||||
c.BgColor, _ = hexStringToColorGo(bgColor)
|
||||
|
||||
if filter != "" {
|
||||
filter = strings.ToLower(filter)
|
||||
|
Reference in New Issue
Block a user