Each Letter a Random Color on Title

I am so prouda myselph I had to share lol


{{ $dtitle := ( .Params.dtitle | default .Site.Params.dtitle ) }}
{{ if and (ne $dtitle false) (gt (countwords .Title) 0) }}
  <header id="sitetitle">
    <h1>{{ range $letter := split .Title "" }}<span style='color: rgb({{ delimit (first 3 (shuffle (seq 0 255))) ", " }});'>{{$letter}}</span>{{ end }}
</h1>
  </header>
{{- end -}}

2 Likes

This is a shortcode that INCORRECTLY does the same thing… will need tweaking but this pheature is not terribly usephul in places other than a title…


{{ range $dcolorletter := split .Inner "" }}<span style='color: rgb({{ delimit (first 3 (shuffle (seq 0 255))) ", " }});'>{{$dcolorletter}}</span>{{ end }}