mirror of
https://github.com/gohugoio/hugo.git
synced 2024-07-08 01:56:15 +00:00
23 lines
626 B
Markdown
23 lines
626 B
Markdown
|
---
|
||
|
title: Colors
|
||
|
description: Applicable to images, returns a slice of the most dominant colors using a simple histogram method.
|
||
|
categories: []
|
||
|
keywords: []
|
||
|
action:
|
||
|
related: []
|
||
|
returnType: '[]string'
|
||
|
signatures: [RESOURCE.Colors]
|
||
|
---
|
||
|
|
||
|
{{< new-in 0.104.0 >}}
|
||
|
|
||
|
```go-html-template
|
||
|
{{ 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" %}}
|