Switched out of mod_tables
This commit is contained in:
parent
ff298ecde2
commit
bb01fa4b60
|
|
@ -1,577 +0,0 @@
|
|||
// =============================================================================
|
||||
// DEPRECATED
|
||||
// =============================================================================
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// TABLE SYSTEM
|
||||
// =============================================================================
|
||||
//
|
||||
// Generic, theme-aware table helpers.
|
||||
//
|
||||
// Every helper accepts an optional `theme` argument.
|
||||
// When omitted, the project's global `theme` is used.
|
||||
//
|
||||
// This means the same table can be rendered with:
|
||||
//
|
||||
// #styled-table(...)
|
||||
// #styled-table(..., theme: theme)
|
||||
// #styled-table(..., theme: other-theme)
|
||||
//
|
||||
// without defining separate table styles.
|
||||
//
|
||||
// =============================================================================
|
||||
#import "variables.typ": theme, theme-var
|
||||
|
||||
// =============================================================================
|
||||
// DEFAULT TABLE CONFIGURATION
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Table geometry
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Geometry is intentionally independent from the theme.
|
||||
// Colours and typography come from the theme; table dimensions don't.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-geometry = (
|
||||
column-gutter: 0pt,
|
||||
row-gutter: 0pt,
|
||||
inset: 0pt,
|
||||
stroke: none,
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Header configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-header-config = (
|
||||
text-size: 7.2pt,
|
||||
weight: "bold",
|
||||
inset-x: 4pt,
|
||||
inset-y: 3pt,
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Body configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-body-config = (
|
||||
text-size: 10pt,
|
||||
inset-x: 4pt,
|
||||
inset-y: 4pt,
|
||||
border-width: 0.3pt,
|
||||
)
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Zebra configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-alternating = (
|
||||
enabled: true,
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Fantasy configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#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,
|
||||
)
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Resolve theme
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let resolve-table-theme(table-theme) = if table-theme == none {
|
||||
theme
|
||||
} else {
|
||||
table-theme
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// COLOURS
|
||||
// =============================================================================
|
||||
//
|
||||
// All table colours are derived from the supplied theme.
|
||||
//
|
||||
// The important distinction:
|
||||
//
|
||||
// theme -> defines the actual visual identity
|
||||
// table -> decides where those colours are used
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-header-fill(table-theme: none) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
t.dark-gold
|
||||
}
|
||||
|
||||
#let table-header-text(table-theme: none) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
t.parchment-light
|
||||
}
|
||||
|
||||
#let table-body-text(table-theme: none) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
t.ink
|
||||
}
|
||||
|
||||
#let table-border(table-theme: none) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
t.border
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Alternating row colours -----------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// Rather than storing colours in the table configuration, derive them from
|
||||
// the selected theme.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-row-fill(index, table-theme: none) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
if not table-alternating.enabled {
|
||||
none
|
||||
} else if calc.even(index) {
|
||||
t.parchment-light
|
||||
} else {
|
||||
t.parchment
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// HEADER
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Single header cell ---------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-header(
|
||||
body,
|
||||
table-theme: none,
|
||||
inset-x: none,
|
||||
inset-y: none,
|
||||
fill: none,
|
||||
align: auto,
|
||||
) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
let inset-x = if inset-x == none {
|
||||
table-header-config.inset-x
|
||||
} else {
|
||||
inset-x
|
||||
}
|
||||
|
||||
let inset-y = if inset-y == none {
|
||||
table-header-config.inset-y
|
||||
} else {
|
||||
inset-y
|
||||
}
|
||||
|
||||
let fill = if fill == none {
|
||||
t.dark-gold
|
||||
} else {
|
||||
fill
|
||||
}
|
||||
|
||||
table.cell(
|
||||
fill: fill,
|
||||
align: align,
|
||||
|
||||
inset: (
|
||||
x: inset-x,
|
||||
y: inset-y,
|
||||
),
|
||||
)[
|
||||
#text(
|
||||
size: table-header-config.text-size,
|
||||
weight: table-header-config.weight,
|
||||
fill: t.parchment-light,
|
||||
)[
|
||||
#body
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// BODY CELL
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Single body cell -----------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-cell(
|
||||
body,
|
||||
table-theme: none,
|
||||
fill: none,
|
||||
inset-x: none,
|
||||
inset-y: none,
|
||||
align: auto,
|
||||
stroke: none,
|
||||
) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
let inset-x = if inset-x == none {
|
||||
table-body-config.inset-x
|
||||
} else {
|
||||
inset-x
|
||||
}
|
||||
|
||||
let inset-y = if inset-y == none {
|
||||
table-body-config.inset-y
|
||||
} else {
|
||||
inset-y
|
||||
}
|
||||
|
||||
let fill = if fill == none {
|
||||
t.parchment
|
||||
} else {
|
||||
fill
|
||||
}
|
||||
|
||||
let stroke = if stroke == none {
|
||||
(bottom: table-body-config.border-width + t.border)
|
||||
} else {
|
||||
stroke
|
||||
}
|
||||
|
||||
table.cell(
|
||||
fill: fill,
|
||||
align: align,
|
||||
stroke: stroke,
|
||||
inset: (
|
||||
x: inset-x,
|
||||
y: inset-y,
|
||||
),
|
||||
)[
|
||||
#text(
|
||||
size: table-body-config.text-size,
|
||||
fill: t.ink,
|
||||
)[
|
||||
#body
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// ROW
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Complete body row ----------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// `inset-x` may be:
|
||||
//
|
||||
// 4pt
|
||||
//
|
||||
// or:
|
||||
//
|
||||
// column => if column == 1 { 2pt } else { 4pt }
|
||||
//
|
||||
// `align` may similarly be a fixed alignment or a function.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-row(
|
||||
cells,
|
||||
index: 0,
|
||||
table-theme: none,
|
||||
inset-x: none,
|
||||
align: auto,
|
||||
fill: none,
|
||||
) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
let row-fill = if fill == none {
|
||||
table-row-fill(index, table-theme: t)
|
||||
} else {
|
||||
fill
|
||||
}
|
||||
|
||||
cells
|
||||
.enumerate()
|
||||
.map(((column, content)) => {
|
||||
let cell-inset = if inset-x == none {
|
||||
table-body-config.inset-x
|
||||
} else if type(inset-x) == function {
|
||||
inset-x(column)
|
||||
} else {
|
||||
inset-x
|
||||
}
|
||||
|
||||
let cell-align = if align == none {
|
||||
none
|
||||
} else if type(align) == function {
|
||||
align(column)
|
||||
} else {
|
||||
align
|
||||
}
|
||||
|
||||
table-cell(
|
||||
content,
|
||||
table-theme: t,
|
||||
fill: row-fill,
|
||||
inset-x: cell-inset,
|
||||
align: cell-align,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// SPECIAL ROWS
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Full-width title row -------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-title(
|
||||
body,
|
||||
colspan,
|
||||
table-theme: none,
|
||||
fill: none,
|
||||
inset-x: 5pt,
|
||||
inset-y: 2.5pt,
|
||||
stroke: none,
|
||||
) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
let fill = if fill == none {
|
||||
t.parchment-light
|
||||
} else {
|
||||
fill
|
||||
}
|
||||
|
||||
let stroke = if stroke == none {
|
||||
(top: 0pt, bottom: 0.6pt + t.border)
|
||||
} else {
|
||||
stroke
|
||||
}
|
||||
|
||||
table.cell(
|
||||
colspan: colspan,
|
||||
fill: fill,
|
||||
stroke: stroke,
|
||||
inset: (
|
||||
x: inset-x,
|
||||
y: inset-y,
|
||||
),
|
||||
)[ #body ]
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Separator -------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let table-rule(
|
||||
colspan,
|
||||
table-theme: none,
|
||||
stroke-width: 0.5pt,
|
||||
) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
table.cell(
|
||||
colspan: colspan,
|
||||
stroke: (
|
||||
bottom: stroke-width + t.border,
|
||||
),
|
||||
inset: 0pt,
|
||||
)[]
|
||||
}
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// COMPLETE TABLE
|
||||
// =============================================================================
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// ----- Styled table ----------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#let styled-table(
|
||||
columns,
|
||||
table-theme: none,
|
||||
align: none,
|
||||
column-gutter: none,
|
||||
row-gutter: none,
|
||||
inset: none,
|
||||
stroke: none,
|
||||
children,
|
||||
) = {
|
||||
let t = resolve-table-theme(table-theme)
|
||||
|
||||
table(
|
||||
columns: columns,
|
||||
|
||||
column-gutter: if column-gutter == none {
|
||||
table-geometry.column-gutter
|
||||
} else {
|
||||
column-gutter
|
||||
},
|
||||
|
||||
row-gutter: if row-gutter == none {
|
||||
table-geometry.row-gutter
|
||||
} else {
|
||||
row-gutter
|
||||
},
|
||||
|
||||
inset: if inset == none {
|
||||
table-geometry.inset
|
||||
} else {
|
||||
inset
|
||||
},
|
||||
|
||||
stroke: if stroke == none {
|
||||
table-geometry.stroke
|
||||
} else {
|
||||
stroke
|
||||
},
|
||||
|
||||
align: align,
|
||||
|
||||
..children,
|
||||
)
|
||||
}
|
||||
// =============================================================================
|
||||
// THEMATIC LABELS & DIVIDERS
|
||||
// =============================================================================
|
||||
|
||||
// =============================================================================
|
||||
// LABEL
|
||||
// =============================================================================
|
||||
|
||||
#let fantasy-label(
|
||||
body,
|
||||
theme: none,
|
||||
size: none,
|
||||
weight: none,
|
||||
tracking: none,
|
||||
fill: none,
|
||||
) = {
|
||||
let t = resolve-table-theme(theme)
|
||||
|
||||
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: none,
|
||||
stroke-width: none,
|
||||
stroke: none,
|
||||
) = {
|
||||
let t = resolve-table-theme(theme)
|
||||
|
||||
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: none,
|
||||
label-size: none,
|
||||
label-weight: none,
|
||||
label-tracking: none,
|
||||
spacing: none,
|
||||
) = {
|
||||
let t = resolve-table-theme(theme)
|
||||
|
||||
let spacing = if spacing == none {
|
||||
fantasy-config.section-spacing
|
||||
} else {
|
||||
spacing
|
||||
}
|
||||
|
||||
fantasy-label(
|
||||
title,
|
||||
theme: t,
|
||||
size: label-size,
|
||||
weight: label-weight,
|
||||
tracking: label-tracking,
|
||||
)
|
||||
|
||||
v(spacing)
|
||||
|
||||
body
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// ----- Project theme -----
|
||||
#import "variables.typ": theme, theme-var
|
||||
#import "mod_tables.typ" as mt
|
||||
#import "spacers.typ" as spacers
|
||||
#import "set_tables.typ" as st
|
||||
#import "macros.typ" as macros
|
||||
|
||||
|
||||
|
|
@ -125,110 +126,88 @@
|
|||
// =============================================================================
|
||||
|
||||
#let technique-tier-table(tier, rows) = {
|
||||
mt.styled-table(
|
||||
(
|
||||
3.1cm,
|
||||
0.48cm,
|
||||
2.15cm,
|
||||
0.72cm,
|
||||
1fr,
|
||||
),
|
||||
// ----- Use continuous backgrounds without column gutters -----
|
||||
column-gutter: 0pt,
|
||||
row-gutter: 0pt,
|
||||
inset: 0pt,
|
||||
stroke: none,
|
||||
align: (
|
||||
left,
|
||||
center,
|
||||
left,
|
||||
center,
|
||||
left,
|
||||
),
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Tier title
|
||||
// -------------------------------------------------------------------------
|
||||
(
|
||||
mt.table-title(
|
||||
[
|
||||
#grid(
|
||||
columns: (auto, 1fr),
|
||||
column-gutter: 0.45em,
|
||||
align: horizon,
|
||||
)[
|
||||
#text(
|
||||
size: 7.5pt,
|
||||
weight: "bold",
|
||||
fill: theme.gold,
|
||||
)[
|
||||
#theme-var("section-symbol")
|
||||
]
|
||||
][
|
||||
#text(
|
||||
size: 8.5pt,
|
||||
weight: "bold",
|
||||
fill: theme.dark-gold,
|
||||
tracking: 0.08em,
|
||||
)[
|
||||
TIER #tier
|
||||
]
|
||||
]
|
||||
],
|
||||
5,
|
||||
table-theme: theme,
|
||||
inset-x: 5pt,
|
||||
inset-y: 2.5pt,
|
||||
st.set-table-style(
|
||||
table-headers: (1,),
|
||||
table(
|
||||
columns: (
|
||||
3.1cm,
|
||||
0.48cm,
|
||||
2.15cm,
|
||||
0.72cm,
|
||||
1fr,
|
||||
),
|
||||
// ----- Use continuous backgrounds without column gutters -----
|
||||
column-gutter: 0pt,
|
||||
row-gutter: 0pt,
|
||||
stroke: none,
|
||||
align: (
|
||||
left,
|
||||
center,
|
||||
left,
|
||||
center,
|
||||
left,
|
||||
),
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Table header
|
||||
// Tier title
|
||||
// -------------------------------------------------------------------------
|
||||
..(
|
||||
table.cell(
|
||||
[
|
||||
#grid(
|
||||
columns: (auto, 1fr),
|
||||
column-gutter: 0.45em,
|
||||
align: horizon,
|
||||
)[
|
||||
#text(
|
||||
size: 7.5pt,
|
||||
weight: "bold",
|
||||
fill: theme.gold,
|
||||
)[
|
||||
#theme-var("section-symbol")
|
||||
]
|
||||
][
|
||||
#text(
|
||||
size: 8.5pt,
|
||||
weight: "bold",
|
||||
fill: theme.dark-gold,
|
||||
tracking: 0.08em,
|
||||
)[
|
||||
TIER #tier
|
||||
]
|
||||
]
|
||||
],
|
||||
colspan: 5,
|
||||
fill: none,
|
||||
stroke: (top: 0pt, bottom: 0.6pt + theme.border),
|
||||
inset: (
|
||||
x: 5pt,
|
||||
y: 2.5pt,
|
||||
),
|
||||
),
|
||||
|
||||
table.header(
|
||||
mt.table-header(
|
||||
// -------------------------------------------------------------------------
|
||||
// Table header
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
table.header(
|
||||
[Technique],
|
||||
inset-x: 4pt,
|
||||
),
|
||||
mt.table-header(
|
||||
[Niv],
|
||||
inset-x: 2pt,
|
||||
align: center,
|
||||
),
|
||||
mt.table-header(
|
||||
[Type],
|
||||
inset-x: 4pt,
|
||||
),
|
||||
mt.table-header(
|
||||
[Coût],
|
||||
inset-x: 2pt,
|
||||
align: center,
|
||||
),
|
||||
mt.table-header(
|
||||
[Effet],
|
||||
inset-x: 4pt,
|
||||
),
|
||||
),
|
||||
// -------------------------------------------------------------------------
|
||||
// Technique rows
|
||||
// -------------------------------------------------------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
// Technique rows
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
..rows
|
||||
.enumerate()
|
||||
.map(((index, row)) => {
|
||||
mt.table-row(
|
||||
technique-row(row),
|
||||
index: index,
|
||||
inset-x: column => {
|
||||
if column == 1 or column == 3 {
|
||||
2pt
|
||||
} else {
|
||||
4pt
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.flatten(),
|
||||
..rows
|
||||
.enumerate()
|
||||
.map(((index, row)) => {
|
||||
technique-row(row)
|
||||
})
|
||||
.flatten(),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
@ -405,7 +384,7 @@
|
|||
|
||||
// ----- Class introduction -----
|
||||
[
|
||||
#mt.fantasy-section("PRÉSENTATION")[
|
||||
#spacers.fantasy-section("PRÉSENTATION", theme-name: "warm")[
|
||||
#text(
|
||||
size: 10.2pt,
|
||||
)[ #class_info.description ]
|
||||
|
|
@ -419,7 +398,7 @@
|
|||
// ----- Class profile and mechanics -----
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
mt.fantasy-rule()
|
||||
spacers.fantasy-rule(theme-name: "warm")
|
||||
|
||||
v(0.7em)
|
||||
|
||||
|
|
@ -436,7 +415,7 @@
|
|||
inset: 0.65em,
|
||||
)[
|
||||
#align(center)[
|
||||
#mt.fantasy-section("PROFIL")[
|
||||
#spacers.fantasy-section("PROFIL", theme-name: "warm")[
|
||||
#image(
|
||||
class_info.radar,
|
||||
width: 82%,
|
||||
|
|
@ -463,7 +442,7 @@
|
|||
size: 10pt,
|
||||
fill: theme.gold,
|
||||
)[#theme-var("section-symbol")]
|
||||
][ #mt.fantasy-label("MÉCANIQUE EXCLUSIVE") ]
|
||||
][ #spacers.fantasy-label("MÉCANIQUE EXCLUSIVE", theme-name: "warm") ]
|
||||
|
||||
#v(0.4em)
|
||||
|
||||
|
|
@ -491,7 +470,7 @@
|
|||
columns: (1fr, auto),
|
||||
align: horizon,
|
||||
)[
|
||||
#mt.fantasy-label("DIFFICULTÉ")
|
||||
#spacers.fantasy-label("DIFFICULTÉ", theme-name: "warm")
|
||||
][
|
||||
#grid(
|
||||
// columns: repeat(5, 0.7em),
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
// =============================================================================
|
||||
|
||||
#import "variables.typ": theme
|
||||
#import "themes.typ": themes
|
||||
#import "themes.typ": resolve-table-theme, themes
|
||||
|
||||
// =============================================================================
|
||||
// CONFIGURATION
|
||||
|
|
@ -53,33 +53,10 @@
|
|||
alternating: true,
|
||||
)
|
||||
|
||||
#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,
|
||||
)
|
||||
|
||||
// =============================================================================
|
||||
// THEME RESOLUTION
|
||||
// =============================================================================
|
||||
|
||||
#let resolve-table-theme(table-theme) = if table-theme == none {
|
||||
theme
|
||||
} else {
|
||||
if table-theme in themes {
|
||||
themes.at(table-theme)
|
||||
} else {
|
||||
theme
|
||||
}
|
||||
}
|
||||
|
||||
// COLOURS
|
||||
|
||||
#let table-header-fill(table-theme: none) = {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
// ----- Imports -----
|
||||
#import "model.typ" as model
|
||||
#import "macros.typ" as macros
|
||||
#import "mod_tables.typ" as mt
|
||||
#import "set_tables.typ" as st
|
||||
|
||||
// ----- Re-expose shared project data -----
|
||||
|
|
@ -16,7 +15,6 @@
|
|||
#let gls-description = model.gls-description
|
||||
#let macros = macros
|
||||
#let ddlvl = macros.ddlvl
|
||||
#let mt = mt
|
||||
|
||||
// ----- Public template for class presentations -----
|
||||
#let school_presentation = model.school_presentation
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
#import "themes.typ" as th
|
||||
|
||||
|
||||
#let fantasy-label = th.fantasy-label
|
||||
#let fantasy-rule = th.fantasy-rule
|
||||
#let fantasy-section = th.fantasy-section
|
||||
|
||||
150
setup/themes.typ
150
setup/themes.typ
|
|
@ -1,4 +1,5 @@
|
|||
// ----- Available color themes -----
|
||||
#let default-theme = "warm"
|
||||
#let themes = (
|
||||
warm: (
|
||||
// ----- Base colors -----
|
||||
|
|
@ -174,19 +175,156 @@
|
|||
)
|
||||
|
||||
// ----- Return the complete selected theme -----
|
||||
#let make-theme(theme: "warm") = {
|
||||
themes.at(theme)
|
||||
#let make-theme(theme-name: default-theme) = {
|
||||
themes.at(theme-name)
|
||||
}
|
||||
|
||||
// ----- Return a safe dynamic theme-variable accessor -----
|
||||
#let make-theme-variable(theme: "warm") = {
|
||||
#let make-theme-variable(theme-name: default-theme) = {
|
||||
let symfinder(name) = {
|
||||
if theme in themes {
|
||||
themes.at(theme).at(name)
|
||||
if theme-name in themes {
|
||||
themes.at(theme-name).at(name)
|
||||
} else {
|
||||
themes.at("warm").at(name)
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// ----- Theme constructors -----
|
||||
#import "themes.typ": make-theme, make-theme-variable
|
||||
#import "themes.typ" as th
|
||||
// make-theme, make-theme-variable, fantasy-label,fantasy-rule,fantasy-section
|
||||
|
||||
// ----- Project metadata -----
|
||||
#let ravenous = (
|
||||
|
|
@ -13,5 +14,5 @@
|
|||
#let color_scheme = "warm"
|
||||
|
||||
// ----- Build the active theme and its variable form -----
|
||||
#let theme = make-theme(theme: color_scheme)
|
||||
#let theme-var = make-theme-variable(theme: color_scheme)
|
||||
#let theme = th.make-theme(theme-name: color_scheme)
|
||||
#let theme-var = th.make-theme-variable(theme-name: color_scheme)
|
||||
|
|
|
|||
Loading…
Reference in New Issue