feat: dynamically generate background color for category links (#1225)
* chore: add +x to run.sh * feat: dynamically generate background color for category links using hash * feat: allow category styles to be overridden by term parameters * refactor: remove default tag background and color variables
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
{{/*
|
||||
This helper is used to generate a background color and text color from a string
|
||||
Used to generate deterministic colors for tags, categories, etc.
|
||||
*/}}
|
||||
|
||||
{{- $str := . -}}
|
||||
{{- $hash := hash.FNV32a $str -}}
|
||||
{{- $h := mod $hash 360 -}}
|
||||
|
||||
{{- $backgroundColor := printf "hsl(%d, 60%%, 84%%)" $h -}}
|
||||
{{- $textColor := printf "hsl(%d, 60%%, 15%%)" $h -}}
|
||||
|
||||
{{- return dict "BackgroundColor" $backgroundColor "TextColor" $textColor "Hue" $h -}}
|
||||
Reference in New Issue
Block a user