331 lines
7.4 KiB
Plaintext
331 lines
7.4 KiB
Plaintext
// ----- Available color themes -----
|
||
#let default-theme = "warm"
|
||
#let themes = (
|
||
warm: (
|
||
// ----- Base colors -----
|
||
ink: rgb("#302c26"),
|
||
muted-ink: rgb("#716957"),
|
||
gold: rgb("#9b8050"),
|
||
dark-gold: rgb("#70582f"),
|
||
parchment: rgb("#F4EBD8"),
|
||
parchment-dark: rgb("#ece4d2"),
|
||
parchment-light: rgb("#fbf9f3"),
|
||
parchment-accent: rgb("#EDE1C8"),
|
||
border: rgb("#c9bda4"),
|
||
blood: rgb("#7A2424"),
|
||
muted: rgb("#756B5D"),
|
||
|
||
// ----- Semantic colors -----
|
||
heading: rgb("#7A2424"),
|
||
heading-accent: rgb("#9b8050"),
|
||
heading-subtle: rgb("#716957"),
|
||
emphasis: rgb("#7A2424"),
|
||
link: rgb("#7A2424"),
|
||
|
||
// ----- Heading and decorative symbols -----
|
||
heading-numbering: "1.",
|
||
section-symbol: "❖",
|
||
chapter-symbol: "✧",
|
||
small-symbol: "•",
|
||
bullet-symbol: "–",
|
||
separator-symbol: "◆",
|
||
// ----- Progress bar and the sort -----
|
||
progress-full: "●",
|
||
progress-half: "◐",
|
||
progress-void: "○",
|
||
// ----- Misc -----
|
||
star: "★",
|
||
font: "Libertinus Serif",
|
||
),
|
||
|
||
steel: (
|
||
// ----- Base colors -----
|
||
ink: rgb("#292B32"),
|
||
muted-ink: rgb("#626873"),
|
||
gold: rgb("#7187A0"),
|
||
dark-gold: rgb("#465A72"),
|
||
parchment: rgb("#EEF1F3"),
|
||
parchment-dark: rgb("#DCE2E7"),
|
||
parchment-light: rgb("#F7F9FA"),
|
||
parchment-accent: rgb("#DCE3E8"),
|
||
border: rgb("#B8C2CC"),
|
||
blood: rgb("#526D85"),
|
||
muted: rgb("#69717C"),
|
||
|
||
// ----- Semantic colors -----
|
||
heading: rgb("#526D85"),
|
||
heading-accent: rgb("#7187A0"),
|
||
heading-subtle: rgb("#626873"),
|
||
emphasis: rgb("#526D85"),
|
||
link: rgb("#526D85"),
|
||
|
||
// ----- Heading and decorative symbols -----
|
||
heading-numbering: "1.",
|
||
section-symbol: "◆",
|
||
chapter-symbol: "◇",
|
||
small-symbol: "·",
|
||
),
|
||
|
||
sage: (
|
||
// ----- Base colors -----
|
||
ink: rgb("#29302A"),
|
||
muted-ink: rgb("#687064"),
|
||
gold: rgb("#7F8F62"),
|
||
dark-gold: rgb("#53603D"),
|
||
parchment: rgb("#F1F2E8"),
|
||
parchment-dark: rgb("#E1E4D5"),
|
||
parchment-light: rgb("#FAFBF5"),
|
||
parchment-accent: rgb("#E3E5D4"),
|
||
border: rgb("#BDC3AE"),
|
||
blood: rgb("#536B45"),
|
||
muted: rgb("#6D7568"),
|
||
|
||
// ----- Semantic colors -----
|
||
heading: rgb("#536B45"),
|
||
heading-accent: rgb("#7F8F62"),
|
||
heading-subtle: rgb("#687064"),
|
||
emphasis: rgb("#536B45"),
|
||
link: rgb("#536B45"),
|
||
|
||
// ----- Heading and decorative symbols -----
|
||
heading-numbering: "1.",
|
||
section-symbol: "❦",
|
||
chapter-symbol: "›",
|
||
small-symbol: "·",
|
||
),
|
||
|
||
bw: (
|
||
// ----- Base colors -----
|
||
ink: rgb("#202020"),
|
||
muted-ink: rgb("#666666"),
|
||
gold: rgb("#777777"),
|
||
dark-gold: rgb("#484848"),
|
||
parchment: rgb("#eeeeee"),
|
||
parchment-dark: rgb("#dddddd"),
|
||
parchment-light: rgb("#fafafa"),
|
||
parchment-accent: rgb("#E2E2E2"),
|
||
border: rgb("#b5b5b5"),
|
||
blood: rgb("#444444"),
|
||
muted: rgb("#707070"),
|
||
|
||
// ----- Semantic colors -----
|
||
heading: rgb("#202020"),
|
||
heading-accent: rgb("#484848"),
|
||
heading-subtle: rgb("#666666"),
|
||
emphasis: rgb("#202020"),
|
||
link: rgb("#202020"),
|
||
),
|
||
|
||
high-contrast: (
|
||
// ----- Core colors -----
|
||
ink: rgb("#111111"),
|
||
muted-ink: rgb("#333333"),
|
||
gold: rgb("#005A9C"),
|
||
dark-gold: rgb("#003B66"),
|
||
parchment: rgb("#FFFFFF"),
|
||
parchment-dark: rgb("#E6E6E6"),
|
||
parchment-light: rgb("#FFFFFF"),
|
||
parchment-accent: rgb("#FFF4CC"),
|
||
border: rgb("#555555"),
|
||
blood: rgb("#A40000"),
|
||
muted: rgb("#444444"),
|
||
|
||
// ----- Semantic colors -----
|
||
heading: rgb("#003B66"),
|
||
heading-accent: rgb("#005A9C"),
|
||
heading-subtle: rgb("#333333"),
|
||
emphasis: rgb("#A40000"),
|
||
link: rgb("#003B66"),
|
||
),
|
||
|
||
yon-sen: (
|
||
// ----- Base colors -----
|
||
ink: rgb("#292724"),
|
||
muted-ink: rgb("#625D54"),
|
||
vermilion: rgb("#9E3B2F"),
|
||
dark-vermilion: rgb("#743129"),
|
||
indigo: rgb("#304C5E"),
|
||
dark-indigo: rgb("#263D4B"),
|
||
moss: rgb("#68705A"),
|
||
dark-moss: rgb("#4D5644"),
|
||
gold: rgb("#A88A54"),
|
||
dark-gold: rgb("#78633D"),
|
||
parchment: rgb("#F3EBDD"),
|
||
parchment-dark: rgb("#E7DDC9"),
|
||
parchment-light: rgb("#FAF6EC"),
|
||
parchment-accent: rgb("#EEE4D1"),
|
||
border: rgb("#C8BDA8"),
|
||
muted: rgb("#777064"),
|
||
|
||
// ----- Semantic colors -----
|
||
heading: rgb("#743129"),
|
||
heading-accent: rgb("#304C5E"),
|
||
heading-subtle: rgb("#625D54"),
|
||
emphasis: rgb("#743129"),
|
||
link: rgb("#304C5E"),
|
||
blood: rgb("#8C3029"),
|
||
|
||
// ----- Heading and decorative symbols -----
|
||
heading-numbering: "一、",
|
||
section-symbol: "※",
|
||
separator-symbol: "—",
|
||
important-symbol: "※",
|
||
quote-symbol: "「",
|
||
),
|
||
)
|
||
|
||
// ----- Return the complete selected theme -----
|
||
#let make-theme(theme-name: default-theme) = {
|
||
themes.at(theme-name)
|
||
}
|
||
|
||
// ----- Return a safe dynamic theme-variable accessor -----
|
||
#let make-theme-variable(theme-name: default-theme) = {
|
||
let symfinder(name) = {
|
||
if theme-name in themes {
|
||
themes.at(theme-name).at(name)
|
||
} else {
|
||
themes.at(default-theme).at(name)
|
||
}
|
||
}
|
||
|
||
symfinder
|
||
}
|
||
|
||
// =============================================================================
|
||
// THEMATIC LABELS & DIVIDERS
|
||
// =============================================================================
|
||
#let resolve-table-theme(theme-name) = if theme-name == none {
|
||
themes.at(default-theme)
|
||
} else {
|
||
if theme-name in themes {
|
||
themes.at(theme-name)
|
||
} else {
|
||
themes.at(default-theme)
|
||
}
|
||
}
|
||
|
||
// =============================================================================
|
||
// LABEL
|
||
// =============================================================================
|
||
|
||
#let fantasy-config = (
|
||
// Label
|
||
label-size: 7.5pt,
|
||
label-weight: "bold",
|
||
label-tracking: 0.12em,
|
||
|
||
// Section
|
||
section-spacing: 0.3em,
|
||
|
||
// Rule
|
||
rule-width: 0.65pt,
|
||
)
|
||
|
||
#let fantasy-label(
|
||
body,
|
||
theme-name: none,
|
||
size: none,
|
||
weight: none,
|
||
tracking: none,
|
||
fill: none,
|
||
) = {
|
||
let t = resolve-table-theme(theme-name)
|
||
|
||
let size = if size == none {
|
||
fantasy-config.label-size
|
||
} else {
|
||
size
|
||
}
|
||
|
||
let weight = if weight == none {
|
||
fantasy-config.label-weight
|
||
} else {
|
||
weight
|
||
}
|
||
|
||
let tracking = if tracking == none {
|
||
fantasy-config.label-tracking
|
||
} else {
|
||
tracking
|
||
}
|
||
|
||
let fill = if fill == none {
|
||
t.dark-gold
|
||
} else {
|
||
fill
|
||
}
|
||
|
||
text(
|
||
size: size,
|
||
weight: weight,
|
||
fill: fill,
|
||
tracking: tracking,
|
||
)[
|
||
#body
|
||
]
|
||
}
|
||
|
||
|
||
// =============================================================================
|
||
// RULE
|
||
// =============================================================================
|
||
|
||
#let fantasy-rule(
|
||
theme-name: none,
|
||
stroke-width: none,
|
||
stroke: none,
|
||
) = {
|
||
let t = resolve-table-theme(theme-name)
|
||
|
||
let stroke-width = if stroke-width == none {
|
||
fantasy-config.rule-width
|
||
} else {
|
||
stroke-width
|
||
}
|
||
|
||
let stroke = if stroke == none {
|
||
stroke-width + t.border
|
||
} else {
|
||
stroke
|
||
}
|
||
|
||
line(
|
||
length: 100%,
|
||
stroke: stroke,
|
||
)
|
||
}
|
||
|
||
|
||
// =============================================================================
|
||
// SECTION
|
||
// =============================================================================
|
||
|
||
#let fantasy-section(
|
||
title,
|
||
body,
|
||
theme-name: none,
|
||
label-size: none,
|
||
label-weight: none,
|
||
label-tracking: none,
|
||
spacing: none,
|
||
) = {
|
||
let spacing = if spacing == none {
|
||
fantasy-config.section-spacing
|
||
} else {
|
||
spacing
|
||
}
|
||
|
||
fantasy-label(
|
||
title,
|
||
theme-name: theme-name,
|
||
size: label-size,
|
||
weight: label-weight,
|
||
tracking: label-tracking,
|
||
)
|
||
|
||
v(spacing)
|
||
|
||
body
|
||
}
|