From 030331565b56d5e9bcf5cdd260c5cde20c355043 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 2 Sep 2026 23:11:23 +0200 Subject: [PATCH] Pill classes test --- setup/models/school.typ | 35 ++++++++++++++++++++++++++++++++++- setup/theme/themes.typ | 17 +++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/setup/models/school.typ b/setup/models/school.typ index 9ffcfd4..bfe3da0 100644 --- a/setup/models/school.typ +++ b/setup/models/school.typ @@ -95,6 +95,39 @@ } //----- Keep the activity kind first and stabilize the remaining type tags ----- +#let origin-pill(name) = { + let accent = theme-var("origin-colors").at(name) + box( + baseline: 0.5pt, + inset: (x: 3pt, y: 1pt), + radius: 2.5pt, + fill: accent.lighten(78%), + stroke: 0.55pt + accent, + )[ + #text(size: 6.8pt, weight: "bold", fill: accent.darken(15%))[#name] + ] +} + +#let format-technique-tag(tag) = { + let origin = none + for name in theme-var("origin-colors").keys() { + if tag.contains("(" + name + ")") { + origin = name + } + } + + if origin == none { + tag + } else { + let label = tag.replace("(" + origin + ")", "").trim() + if label == "" { + origin-pill(origin) + } else { + [#label #origin-pill(origin)] + } + } +} + #let format-technique-type(value) = { let tags = value .split(",") @@ -112,7 +145,7 @@ .filter(tag => not (tag in activity-tags)) .sorted(key: tag => lower(tag)) - (activity-tags + other-tags).join(", ") + (activity-tags + other-tags).map(format-technique-tag).join([, ]) } //----- Convert a TSV row into the table's five displayed cells ----- diff --git a/setup/theme/themes.typ b/setup/theme/themes.typ index ef00d9f..c072331 100644 --- a/setup/theme/themes.typ +++ b/setup/theme/themes.typ @@ -44,6 +44,23 @@ emphasis: rgb("#7A2424"), link: rgb("#7A2424"), + //----- Origin pills ----- + origin-colors: ( + Abyssal: rgb("#51406F"), + Baloth: rgb("#8A4738"), + Béhémoth: rgb("#73523C"), + Célestial: rgb("#B07C28"), + Djieien: rgb("#765078"), + Dragon: rgb("#A43F32"), + Fenrir: rgb("#526A78"), + Guivre: rgb("#6C7040"), + Kraken: rgb("#32677A"), + Léviathan: rgb("#38756C"), + Röc: rgb("#9A6335"), + Tréant: rgb("#4F7047"), + Yénuï: rgb("#8A4964"), + ), + //----- Heading and decorative symbols ----- heading-numbering: "1.", section-symbol: "❖",