hugo/docs/content/en/methods/resource/Colors.md
2023-12-04 15:24:01 +01:00

626 B

title description categories keywords action
Colors Applicable to images, returns a slice of the most dominant colors using a simple histogram method.
related returnType signatures
[]string
RESOURCE.Colors

{{< new-in 0.104.0 >}}

{{ with resources.Get "images/a.jpg" }}
  {{ .Colors }} → [#bebebd #514947 #768a9a #647789 #90725e #a48974]
{{ end }}

This method is fast, but if you also scale down your images, it would be good for performance to extract the colors from the scaled image.

{{% include "methods/resource/_common/global-page-remote-resources.md" %}}