fix color hardcoding

This commit is contained in:
Ernesto Martinez Garcia 2025-09-05 19:01:58 +02:00
commit dbdfce08a1
3 changed files with 88 additions and 82 deletions

View file

@ -4,13 +4,16 @@
#import "tugcolors.typ" #import "tugcolors.typ"
#import "helper.typ": * #import "helper.typ": *
#import "logos.typ": * #import "logos.typ": *
#import "macros.typ": *
// Core Imports
#import "@preview/codly:1.3.0": * // For bindings #import "@preview/codly:1.3.0": * // For bindings
#import "@preview/cetz:0.3.2" // For bindings #import "@preview/cetz:0.3.2" // For bindings
#import "@preview/fletcher:0.5.5" as fletcher: edge, node // For bindings #import "@preview/fletcher:0.5.5" as fletcher: edge, node // For bindings
#import "@preview/tiaoma:0.3.0" // For auto QR generation #import "@preview/tiaoma:0.3.0" // For auto QR generation
// Styling Macro Imports
#import "@preview/showybox:2.0.4": showybox
// Touying bindings for cetz // Touying bindings for cetz
#let cetz-canvas = touying-reducer.with( #let cetz-canvas = touying-reducer.with(
reduce: cetz.canvas, reduce: cetz.canvas,
@ -410,4 +413,85 @@
body body
} }
// -----------------------------------------------------------------------------
// Styling Macros
// -----------------------------------------------------------------------------
#let quote-block(
top-pad: 0.55cm,
color: tugcolors.tug,
spacing: 0.3cm,
body,
) = [
#touying-fn-wrapper((self: none) => [
// Grid with the design
#let g(s: 0cm, body) = [
#grid(
columns: (0.195cm, auto),
column-gutter: 0.7cm,
row-gutter: 0cm,
[
#rect(
fill: self.colors.primary,
height: s + top-pad,
)
],
align(horizon, body),
)
]
// We compute its "auto" heigth and then print it with the correct height
#layout(size => {
let (height,) = measure(width: size.width, g(body))
g(s: height, body)
})
#v(spacing)
])
]
// https://tabler.io/icons
#let color-block(
title,
icon: none,
spacing: 0.78em,
color: none,
color-body: tugcolors.lite,
body
) = [
#import "@preview/tableau-icons:0.331.0": *
#touying-fn-wrapper((self: none) => [
#show emph: it => {
text(weight: "medium", fill: self.colors.primary, it.body)
}
#showybox(
title-style: (
color: white,
sep-thickness: 0pt,
),
frame: (
//inset: 0.4em,
radius: 0pt,
thickness: 0pt,
border-color: if color == none { self.colors.primary } else { color },
title-color: if color == none { self.colors.primary } else { color },
body-color: color-body,
inset: (x: 0.55em, y: 0.65em),
),
above: spacing,
below: spacing,
title: if icon == none {
align(horizon)[#strong(title)]
} else {
align(horizon)[
#draw-icon(icon, height: 1.2em, baseline: 20%, fill: white) #h(0.2cm) #strong[#title]
]
},
body,
)
])
]
//vim:tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab colorcolumn=81 //vim:tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab colorcolumn=81

View file

@ -1,81 +0,0 @@
#import "tugcolors.typ"
#let quote-block(
top-pad: 0.65cm,
color: tugcolors.tug,
spacing: 0.3cm,
body,
) = context [
// Grid with the design
#let g(s: 0cm, body) = [
#grid(
columns: (0.195cm, auto),
column-gutter: 0.7cm,
row-gutter: 0cm,
[
#rect(
fill: tugcolors.tug,
height: s + top-pad,
)
],
align(horizon, body),
)
]
// We compute its "auto" heigth and then print it with the correct height
#layout(size => {
let (height,) = measure(width: size.width, g(body))
g(s: height, body)
})
#v(spacing)
]
#import "@preview/showybox:2.0.4": showybox
#import "@preview/tableau-icons:0.331.0": *
#let color-block(title, icon: none,
spacing: 0.78em, color: tugcolors.tug, color-body: tugcolors.lite, body) = [
#show emph: it => {
text(weight: "medium", fill: self.colors.primary, it.body)
}
#showybox(
title-style: (
color: white,
sep-thickness: 0pt,
),
frame: (
//inset: 0.4em,
radius: 0pt,
thickness: 0pt,
border-color: color,
title-color: color,
body-color: color-body,
inset: (x: 0.55em, y: 0.65em),
),
above: spacing,
below: spacing,
title: if icon == none {
align(horizon)[#strong(title)]
} else {
align(horizon)[
#draw-icon(icon, height: 1.2em, baseline: 20%, fill: white) #h(0.2cm) #strong[#title]
]
},
body,
)
]
// https://tabler.io/icons
#let icon-block(title, icon, body) = [
#color-block([#v(-0.2cm) #draw-icon(icon, height: 1.2em, baseline: 20%, fill: white) #h(0.2cm) #strong[#title] #v(-0.25cm)])[
#body
]
]
//vim:tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab colorcolumn=81

View file

@ -15,6 +15,9 @@
config-common( config-common(
handout: false, handout: false,
), ),
config-colors(
primary: black,
),
) )
// -------------------------------[[ CUT HERE ]]-------------------------------- // -------------------------------[[ CUT HERE ]]--------------------------------