Move tints from style attributes to classes !15

merged merged by cmc on 2026-11-12 17:13 UTC · cmc/cleberg.net:csp-inline-tints into main

4 files changed, +19 −12

Layout: unified · split

content/templates/app.html +3 −2
@@ -1,14 +1,15 @@
1{# An app page, for everything under apps/. Selected by the [[pages]] rule in orgo.toml. 1{# An app page, for everything under apps/. Selected by the [[pages]] rule in orgo.toml.
2 2
3 The org files are krz.sh's app pages (krz/krz.sh content/apps/), so the keywords are 3 The org files are krz.sh's app pages (krz/krz.sh content/apps/), so the keywords are
4 theirs: #+TINT, #+ICON, #+HERO, #+TAGLINE, #+PLATFORMS, #+APPSTORE, #+REPO, #+PRIVACY, 4 theirs: #+TINT (copied into styles.css as a .t-<dir> class, since the CSP blocks style
5 attributes), #+ICON, #+HERO, #+TAGLINE, #+PLATFORMS, #+APPSTORE, #+REPO, #+PRIVACY,
5 #+HIGHLIGHT_n ("title | text") and #+SHOT_n ("src | alt | caption"). The body is the 6 #+HIGHLIGHT_n ("title | text") and #+SHOT_n ("src | alt | caption"). The body is the
6 app's write-up. #} 7 app's write-up. #}
7{% extends "base.html" %} 8{% extends "base.html" %}
8{% block mainclass %}app{% endblock %} 9{% block mainclass %}app{% endblock %}
9{% block main %} 10{% block main %}
10{%- set k = page.keywords %} 11{%- set k = page.keywords %}
11<section class="band" style="--tint: {{ k.tint }}"> 12<section class="band t-{{ (page.url | split("/"))[1] }}">
12<div class="band-in"> 13<div class="band-in">
13<div class="band-copy"> 14<div class="band-copy">
14<p class="back"><a href="{{ root }}index.html">All apps</a></p> 15<p class="back"><a href="{{ root }}index.html">All apps</a></p>
content/templates/data/work.html +9 −9
@@ -1,17 +1,17 @@
1{#- The work on the home page that is not an app. Imported by home.html; the apps 1{#- The work on the home page that is not an app. Imported by home.html; the apps
2 themselves are the pages under apps/. 2 themselves are the pages under apps/.
3 3
4 `teaser` is the unannounced app: no page, no link. Software entries carry a tint for 4 `teaser` is the unannounced app: no page, no link. Each software entry's icon tint is
5 their icon. The Audit Labs chain is in the order evidence moves through it. -#} 5 a .t-<name> class in styles.css, since the CSP blocks style attributes. The Audit Labs chain is in the order evidence moves through it. -#}
6{%- set teaser = {"name": "Coming", "tint": "#2f4858"} -%} 6{%- set teaser = {"name": "Coming"} -%}
7 7
8{%- set software = [ 8{%- set software = [
9 {"name": "orgo", "url": "https://gitbay.org/krz/orgo", "desc": "builds this site", "tint": "#248a3d"}, 9 {"name": "orgo", "url": "https://gitbay.org/krz/orgo", "desc": "builds this site"},
10 {"name": "gitbay", "url": "https://gitbay.org", "desc": "a CLI-first git forge", "tint": "#3634a3"}, 10 {"name": "gitbay", "url": "https://gitbay.org", "desc": "a CLI-first git forge"},
11 {"name": "org-live", "url": "https://org.krz.sh", "desc": "org on the web", "tint": "#0c817b"}, 11 {"name": "org-live", "url": "https://org.krz.sh", "desc": "org on the web"},
12 {"name": "nfogen", "url": "https://gitbay.org/krz/nfogen", "desc": "NFO files", "tint": "#6c6c70"}, 12 {"name": "nfogen", "url": "https://gitbay.org/krz/nfogen", "desc": "NFO files"},
13 {"name": "SkunkyArt", "url": "https://gitbay.org/krz/skunky-art", "desc": "DeviantArt frontend", "tint": "#c93400"}, 13 {"name": "SkunkyArt", "url": "https://gitbay.org/krz/skunky-art", "desc": "DeviantArt frontend"},
14 {"name": "1kb", "url": "https://rogue.krz.sh/1kb/#g", "desc": "tiny roguelike", "tint": "#d70015"}, 14 {"name": "1kb", "url": "https://rogue.krz.sh/1kb/#g", "desc": "tiny roguelike"},
15] -%} 15] -%}
16 16
17{%- set audit_chain = [ 17{%- set audit_chain = [
content/templates/home.html +1 −1
@@ -94,7 +94,7 @@ along the way.</p>
94<h2>Software</h2> 94<h2>Software</h2>
95<ul> 95<ul>
96{%- for s in work.software %} 96{%- for s in work.software %}
97<li><a href="{{ s.url }}"><i style="--tint: {{ s.tint }}" aria-hidden="true">{{ s.name[:1] | upper }}</i><strong>{{ s.name }}</strong><span>{{ s.desc }}</span></a></li> 97<li><a href="{{ s.url }}"><i class="t-{{ s.name | lower }}" aria-hidden="true">{{ s.name[:1] | upper }}</i><strong>{{ s.name }}</strong><span>{{ s.desc }}</span></a></li>
98{%- endfor %} 98{%- endfor %}
99</ul> 99</ul>
100</section> 100</section>
theme/static/styles.css +6
@@ -152,6 +152,12 @@ pre code { color: #323232; }
152@media (prefers-reduced-motion: reduce) { .screen .apps img { transition: none; } } 152@media (prefers-reduced-motion: reduce) { .screen .apps img { transition: none; } }
153 153
154/* A band per app: the top of each app page */ 154/* A band per app: the top of each app page */
155/* Tints for app bands (.t-<apps dir>) and software icons (.t-<name>). They are classes
156 because the CSP's style-src 'self' blocks style attributes. */
157.t-hutch { --tint: #3d5a80; } .t-domain-dig { --tint: #1c57bd; } .t-gitbay { --tint: #4338ca; } .t-orgstar { --tint: #5b7a2e; }
158.t-daybyday { --tint: #c2410c; } .t-moonrise { --tint: #0a1424; } .t-hellsite { --tint: #2a5bd7; }
159.t-orgo { --tint: #248a3d; } .w-software .t-gitbay { --tint: #3634a3; } .t-org-live { --tint: #0c817b; } .t-nfogen { --tint: #6c6c70; }
160.t-skunkyart { --tint: #c93400; } .t-1kb { --tint: #d70015; }
155.band { background: color-mix(in srgb, var(--tint) 80%, #000); color: #f5f5f7; } 161.band { background: color-mix(in srgb, var(--tint) 80%, #000); color: #f5f5f7; }
156.band-in { max-width: var(--wide); margin: 0 auto; padding: var(--s-section) var(--pad); display: grid; grid-template-columns: 5fr 7fr; gap: var(--s-gutter); align-items: center; } 162.band-in { max-width: var(--wide); margin: 0 auto; padding: var(--s-section) var(--pad); display: grid; grid-template-columns: 5fr 7fr; gap: var(--s-gutter); align-items: center; }
157.band-head { display: flex; align-items: center; gap: var(--s-4); } 163.band-head { display: flex; align-items: center; gap: var(--s-4); }