Simulate background-clip: text for browsers that don't support it

Move the heading generating to a partial that iteratively wraps each character
of the heading in a <span>. The CSS for the site heading uses :nth-child to
color each span a different color.
This commit is contained in:
Eryn Wells 2023-05-17 08:18:52 -07:00
parent 0e81f019a7
commit fc35499d6c
5 changed files with 31 additions and 4 deletions

View file

@ -309,9 +309,33 @@ h1, h2, h3, h4, h5, h6 {
} }
h1.site { h1.site {
--site-title-color1: rgb(103, 128, 229);
--site-title-color2: rgb(130, 90, 227);
--site-title-color3: rgb(135, 101, 228);
--site-title-color4: rgb(125, 115, 229);
--site-title-color5: rgb(107, 130, 230);
--site-title-color6: rgb(77, 153, 232);
--site-title-color7: rgb(74, 136, 230);
--site-title-color8: rgb(71, 128, 228);
--site-title-color9: rgb(65, 80, 224);
--site-title-color10: rgb(61, 58, 223);
color: rgb(var(--mid-blue)); color: rgb(var(--mid-blue));
font-size: 2.5em; font-size: 2.5em;
} }
@supports not (background-clip: text) {
h1.site span:nth-child(10n + 1) { color: var(--site-title-color1); }
h1.site span:nth-child(10n + 2) { color: var(--site-title-color2); }
h1.site span:nth-child(10n + 3) { color: var(--site-title-color3); }
h1.site span:nth-child(10n + 4) { color: var(--site-title-color4); }
h1.site span:nth-child(10n + 5) { color: var(--site-title-color5); }
h1.site span:nth-child(10n + 6) { color: var(--site-title-color6); }
h1.site span:nth-child(10n + 7) { color: var(--site-title-color7); }
h1.site span:nth-child(10n + 8) { color: var(--site-title-color8); }
h1.site span:nth-child(10n + 9) { color: var(--site-title-color9); }
h1.site span:nth-child(10n) { color: var(--site-title-color10); }
}
@supports (background-clip: text) { @supports (background-clip: text) {
h1.site { h1.site {
background: background:

View file

@ -1,5 +1,7 @@
baseURL: https://erynwells.me/ baseURL: https://erynwells.me/
languageCode: en-US languageCode: en-US
title: Erynwells.me title: Eryn Rachel Wells
copyright: Copyright © 2020—2022 Eryn Wells copyright: Copyright © 2020—2023 Eryn Wells
defaultContentLanguage: en defaultContentLanguage: en
params:
shortTitle: Eryn Wells

View file

@ -1,7 +1,7 @@
{{ define "body" }} {{ define "body" }}
<main> <main>
<div class="platter grid"> <div class="platter grid">
<h1 class="site">{{ .Title }}</h1> <h1 class="site">{{ partial "site_name.html" .Title }}</h1>
<div id="content"> <div id="content">
{{ .Content }} {{ .Content }}
</div> </div>

View file

@ -3,7 +3,7 @@
<header class="site"> <header class="site">
<div class="platter grid"> <div class="platter grid">
<h1 class="site"> <h1 class="site">
<a class="site-name" href="{{ `` | absURL }}">Eryn Wells</a> <a class="site-name" href="{{ `` | absURL }}">{{ partial "site_name.html" site.Params.shortTitle }}</a>
</h1> </h1>
<nav class="site bulleted"> <nav class="site bulleted">
{{ with site.Menus.main }} {{ with site.Menus.main }}

View file

@ -0,0 +1 @@
{{ range (split . "") }}<span>{{ . }}</span>{{ end }}