mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-12-23 08:47:50 +00:00
Some checks failed
tinymist::ci / Duplicate Actions Detection (push) Has been cancelled
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Has been cancelled
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Has been cancelled
tinymist::ci / prepare-build (push) Has been cancelled
tinymist::gh_pages / build-gh-pages (push) Has been cancelled
tinymist::ci / E2E Tests (darwin-arm64 on macos-latest) (push) Has been cancelled
tinymist::ci / E2E Tests (linux-x64 on ubuntu-22.04) (push) Has been cancelled
tinymist::ci / E2E Tests (linux-x64 on ubuntu-latest) (push) Has been cancelled
tinymist::ci / E2E Tests (win32-x64 on windows-2019) (push) Has been cancelled
tinymist::ci / E2E Tests (win32-x64 on windows-latest) (push) Has been cancelled
tinymist::ci / build-binary (push) Has been cancelled
tinymist::ci / build-vsc-assets (push) Has been cancelled
tinymist::ci / build-vscode (push) Has been cancelled
tinymist::ci / build-vscode-others (push) Has been cancelled
tinymist::ci / publish-vscode (push) Has been cancelled
* revert: "test: bad changes" * feat: m1source
55 lines
1.2 KiB
Typst
55 lines
1.2 KiB
Typst
#import "@preview/shiroa:0.2.3": templates, book-sys
|
|
#import templates: *
|
|
|
|
#let is-md-target = book-sys.target == "md"
|
|
#let sys-is-html-target = book-sys.sys-is-html-target
|
|
|
|
// Theme (Colors)
|
|
#let dark-theme = book-theme-from(toml("theme-style.toml"), xml: it => xml(it), target: "web-ayu")
|
|
#let light-theme = book-theme-from(
|
|
toml("theme-style.toml"),
|
|
xml: it => xml(it),
|
|
target: if sys-is-html-target {
|
|
"web-light"
|
|
} else {
|
|
"pdf"
|
|
},
|
|
)
|
|
#let default-theme = if sys-is-html-target {
|
|
dark-theme
|
|
} else {
|
|
light-theme
|
|
}
|
|
|
|
#let theme-box(render, tag: "div", theme-tag: none) = if is-md-target {
|
|
show: html.elem.with(tag)
|
|
show: html.elem.with("picture")
|
|
html.elem(
|
|
"m1source",
|
|
attrs: (media: "(prefers-color-scheme: dark)"),
|
|
render(dark-theme),
|
|
)
|
|
render(light-theme)
|
|
} else if sys-is-html-target {
|
|
if theme-tag == none {
|
|
theme-tag = tag
|
|
}
|
|
html.elem(
|
|
tag,
|
|
attrs: (class: "code-image themed"),
|
|
{
|
|
html.elem(
|
|
theme-tag,
|
|
render(dark-theme),
|
|
attrs: (class: "dark"),
|
|
)
|
|
html.elem(
|
|
theme-tag,
|
|
render(light-theme),
|
|
attrs: (class: "light"),
|
|
)
|
|
},
|
|
)
|
|
} else {
|
|
render(default-theme)
|
|
}
|