mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
resources/images: Add $image.Colors
Which returns the most dominant colors of an image using a simple histogram method. Fixes #10307
This commit is contained in:
@@ -84,6 +84,10 @@ func TestImageTransformBasic(t *testing.T) {
|
||||
c.Assert(img.Height(), qt.Equals, h)
|
||||
}
|
||||
|
||||
colors, err := image.Colors()
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(colors, qt.DeepEquals, []string{"#2d2f33", "#a49e93", "#d39e59", "#a76936", "#737a84", "#7c838b"})
|
||||
|
||||
c.Assert(image.RelPermalink(), qt.Equals, "/a/sunset.jpg")
|
||||
c.Assert(image.ResourceType(), qt.Equals, "image")
|
||||
assertWidthHeight(image, 900, 562)
|
||||
|
Reference in New Issue
Block a user