add inline color block (#39)

This commit is contained in:
Sven Vogel 2024-08-12 18:07:44 +02:00
parent a4e6e6c47a
commit 08a6eaf79f
2 changed files with 21 additions and 5 deletions

View File

@ -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)
]
]
]
]

View File

@ -82,6 +82,7 @@ $
#pagebreak()
#lorem(100)
#inline-color("#ff0000", "red")
#figure(
```rust
@ -101,4 +102,4 @@ fn main() {
= Conclusion
#lorem(320)
#lorem(320)