From 08a6eaf79f9b3d405037e4e6d265f4a3f0ae4f8c Mon Sep 17 00:00:00 2001 From: servostar Date: Mon, 12 Aug 2024 18:07:44 +0200 Subject: [PATCH] add inline color block (#39) --- src/lib.typ | 23 +++++++++++++++++++---- template/main.typ | 3 ++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/lib.typ b/src/lib.typ index 905e383..5028385 100644 --- a/src/lib.typ +++ b/src/lib.typ @@ -7,7 +7,7 @@ // Edited: 27.06.2024 // License: MIT - #import "conf.typ": validate-config + #import "conf.typ": validate-config, default-config #import "branding.typ": * #import "style.typ": global_styled_doc, content_styled, end_styled #import "glossary.typ": glossary @@ -24,6 +24,21 @@ [#pagebreak()] } +#let inline-color(color, content) = { + box( + stroke: 1pt + ABB-GRAY-05, + radius: 2pt, + inset: (left: 2pt, right: 2pt), + outset: (top: 4pt, bottom: 4pt), + fill: ABB-GRAY-06, + [#box(fill: rgb(color), radius: 2pt, inset: 0pt, width: 0.75em, height: 0.75em) #text( + font: default-config.style.code.font, + size: default-config.style.code.size, + content, + )], + ) +} + // start of template pages and styles #let dhbw-template(config, body) = [ #let config = validate-config(config) @@ -57,7 +72,7 @@ #new-preface(config) #new_outline() - // glossary is built inline here because the links must be + // glossary is built inline here because the links must be // exposed to the entire document #import "glossarium.typ": * #show: make-glossary @@ -71,7 +86,7 @@ glossary(config.thesis.glossary)) pagebreak(weak: true) - } + } #counter(page).update(1) // mark end of prelude @@ -94,4 +109,4 @@ #show-appendix(config: config) ] ] -] \ No newline at end of file +] diff --git a/template/main.typ b/template/main.typ index abff4a4..1039d74 100644 --- a/template/main.typ +++ b/template/main.typ @@ -82,6 +82,7 @@ $ #pagebreak() #lorem(100) +#inline-color("#ff0000", "red") #figure( ```rust @@ -101,4 +102,4 @@ fn main() { = Conclusion -#lorem(320) \ No newline at end of file +#lorem(320)