Skip to content

Commit

Permalink
refactor: refactor color and fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed Jan 17, 2024
1 parent bf9be70 commit 0e9dfb2
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 33 deletions.
4 changes: 2 additions & 2 deletions docs/docs/themes/dewdrop.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ Dewdrop uses the following default color theme:
```typst
#let s = (s.methods.colors)(
self: s,
neutral-extradark: rgb("#000000"),
neutral-darkest: rgb("#000000"),
neutral-dark: rgb("#202020"),
neutral-light: rgb("#f3f3f3"),
neutral-extralight: rgb("#ffffff"),
neutral-lightest: rgb("#ffffff"),
primary: primary,
)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/themes/metropolis.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Metropolis uses the following default color theme:
```typst
#let s = (s.methods.colors)(
self: s,
neutral-extralight: rgb("#fafafa"),
neutral-lightest: rgb("#fafafa"),
primary-dark: rgb("#23373b"),
secondary-light: rgb("#eb811b"),
secondary-lighter: rgb("#d6c6b7"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ Dewdrop 默认使用了
```typst
#let s = (s.methods.colors)(
self: s,
neutral-extradark: rgb("#000000"),
neutral-darkest: rgb("#000000"),
neutral-dark: rgb("#202020"),
neutral-light: rgb("#f3f3f3"),
neutral-extralight: rgb("#ffffff"),
neutral-lightest: rgb("#ffffff"),
primary: primary,
)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Metropolis 默认使用了
```typst
#let s = (s.methods.colors)(
self: s,
neutral-extralight: rgb("#fafafa"),
neutral-lightest: rgb("#fafafa"),
primary-dark: rgb("#23373b"),
secondary-light: rgb("#eb811b"),
secondary-lighter: rgb("#d6c6b7"),
Expand Down
20 changes: 10 additions & 10 deletions slide.typ
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
// touying slides-end mark
#let slides-end = metadata((kind: "touying-slides-end"))
// touying equation mark
#let touying-equation(block: true, numbering: none, supplement: auto, body) = {
#let touying-equation(block: true, numbering: none, supplement: auto, scope: (:), body) = {
metadata((
kind: "touying-equation",
block: block,
numbering: numbering,
supplement: supplement,
scope: (:),
scope: scope,
body: {
if type(body) == function {
body
Expand Down Expand Up @@ -396,31 +396,31 @@
neutral: rgb("#303030"),
neutral-light: rgb("#a0a0a0"),
neutral-lighter: rgb("#d0d0d0"),
neutral-extralight: rgb("#ffffff"),
neutral-lightest: rgb("#ffffff"),
neutral-dark: rgb("#202020"),
neutral-darker: rgb("#101010"),
neutral-extradark: rgb("#000000"),
neutral-darkest: rgb("#000000"),
primary: rgb("#303030"),
primary-light: rgb("#a0a0a0"),
primary-lighter: rgb("#d0d0d0"),
primary-extralight: rgb("#ffffff"),
primary-lightest: rgb("#ffffff"),
primary-dark: rgb("#202020"),
primary-darker: rgb("#101010"),
primary-extradark: rgb("#000000"),
primary-darkest: rgb("#000000"),
secondary: rgb("#303030"),
secondary-light: rgb("#a0a0a0"),
secondary-lighter: rgb("#d0d0d0"),
secondary-extralight: rgb("#ffffff"),
secondary-lightest: rgb("#ffffff"),
secondary-dark: rgb("#202020"),
secondary-darker: rgb("#101010"),
secondary-extradark: rgb("#000000"),
secondary-darkest: rgb("#000000"),
tertiary: rgb("#303030"),
tertiary-light: rgb("#a0a0a0"),
tertiary-lighter: rgb("#d0d0d0"),
tertiary-extralight: rgb("#ffffff"),
tertiary-lightest: rgb("#ffffff"),
tertiary-dark: rgb("#202020"),
tertiary-darker: rgb("#101010"),
tertiary-extradark: rgb("#000000"),
tertiary-darkest: rgb("#000000"),
),
// handle mode
handout: false,
Expand Down
18 changes: 9 additions & 9 deletions themes/dewdrop.typ
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
..args,
) = {
self.page-args = self.page-args + (
fill: self.colors.neutral-extralight,
fill: self.colors.neutral-lightest,
) + if self.d-navigation == "sidebar" {(
margin: (top: 0em, bottom: 1em, left: 0em, right: 0em),
)} else if self.d-navigation == "mini-slides" {(
Expand All @@ -32,7 +32,7 @@
x: self.d-mini-slides.x,
..(if self.d-navigation == "sidebar" { (x: self.d-sidebar.width) } else { () }),
)
set text(fill: self.colors.neutral-extradark)
set text(fill: self.colors.neutral-darkest)
show heading: set text(fill: self.colors.primary)
show: args.named().at("setting", default: body => body)
body
Expand All @@ -50,7 +50,7 @@
self.page-args.footer = none
let info = self.info + args.named()
let content = {
set text(fill: self.colors.neutral-extradark)
set text(fill: self.colors.neutral-darkest)
set align(center + horizon)
block(width: 100%, inset: 3em, {
block(
Expand Down Expand Up @@ -92,7 +92,7 @@
fill: self.colors.primary,
margin: 2em,
)
set text(fill: self.colors.neutral-extralight, size: 1.5em)
set text(fill: self.colors.neutral-lightest, size: 1.5em)
let touying-slide = self.methods.touying-slide
touying-slide(self: self, repeat: none, align(horizon + center, body))
}
Expand Down Expand Up @@ -250,10 +250,10 @@
// color theme
self = (self.methods.colors)(
self: self,
neutral-extradark: rgb("#000000"),
neutral-darkest: rgb("#000000"),
neutral-dark: rgb("#202020"),
neutral-light: rgb("#f3f3f3"),
neutral-extralight: rgb("#ffffff"),
neutral-lightest: rgb("#ffffff"),
primary: primary,
)
// save the variables for later use
Expand All @@ -275,13 +275,13 @@
set text(size: 0.8em)
set align(bottom)
show: pad.with(.5em)
text(fill: self.colors.neutral-extradark.lighten(40%), utils.call-or-display(self, self.d-footer))
text(fill: self.colors.neutral-darkest.lighten(40%), utils.call-or-display(self, self.d-footer))
h(1fr)
text(fill: self.colors.neutral-extradark.lighten(20%), utils.call-or-display(self, self.d-footer-right))
text(fill: self.colors.neutral-darkest.lighten(20%), utils.call-or-display(self, self.d-footer-right))
}
self.page-args = self.page-args + (
paper: "presentation-" + aspect-ratio,
fill: self.colors.neutral-extralight,
fill: self.colors.neutral-lightest,
header: header,
footer: footer,
margin: 0em,
Expand Down
10 changes: 5 additions & 5 deletions themes/metropolis.typ
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
) = {
self.page-args = self.page-args + (
margin: margin,
fill: self.colors.neutral-extralight,
fill: self.colors.neutral-lightest,
)
if title != auto {
self.m-title = title
Expand Down Expand Up @@ -112,7 +112,7 @@
fill: self.colors.primary-dark,
margin: 2em,
)
set text(fill: self.colors.neutral-extralight, size: 1.5em)
set text(fill: self.colors.neutral-lightest, size: 1.5em)
let touying-slide = self.methods.touying-slide
touying-slide(self: self, repeat: none, align(horizon + center, body))
}
Expand Down Expand Up @@ -148,7 +148,7 @@
// color theme
self = (self.methods.colors)(
self: self,
neutral-extralight: rgb("#fafafa"),
neutral-lightest: rgb("#fafafa"),
primary-dark: rgb("#23373b"),
secondary-light: rgb("#eb811b"),
secondary-lighter: rgb("#d6c6b7"),
Expand All @@ -171,7 +171,7 @@
if self.m-title != none {
show: m-cell.with(fill: self.colors.primary-dark, inset: 1em)
set align(horizon)
set text(fill: self.colors.neutral-extralight, size: 1.2em)
set text(fill: self.colors.neutral-lightest, size: 1.2em)
utils.fit-to-width(grow: false, 100%, text(weight: "medium", utils.call-or-display(self, self.m-title)))
} else { [] }
}
Expand All @@ -189,7 +189,7 @@
}
self.page-args = self.page-args + (
paper: "presentation-" + aspect-ratio,
fill: self.colors.neutral-extralight,
fill: self.colors.neutral-lightest,
header: header,
footer: footer,
margin: 0em,
Expand Down
6 changes: 3 additions & 3 deletions themes/simple.typ
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
self = (self.methods.colors)(
self: self,
neutral-light: gray,
neutral-extralight: background,
neutral-extradark: foreground,
neutral-lightest: background,
neutral-darkest: foreground,
primary: primary,
)
// save the variables for later use
Expand All @@ -80,7 +80,7 @@
let footer(self) = deco-format(self.simple-footer + h(1fr) + self.simple-footer-right)
self.page-args = self.page-args + (
paper: "presentation-" + aspect-ratio,
fill: self.colors.neutral-extralight,
fill: self.colors.neutral-lightest,
header: header,
footer: footer,
)
Expand Down
3 changes: 3 additions & 0 deletions utils/utils.typ
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@
} else if type(visible-subslides) == "string" {
let parts = _parse-subslide-indices(visible-subslides)
_check-visible(idx, parts)
} else if type(visible-subslides) == content and visible-subslides.has("text") {
let parts = _parse-subslide-indices(visible-subslides.text)
_check-visible(idx, parts)
} else if type(visible-subslides) == "dictionary" {
let lower-okay = if "beginning" in visible-subslides {
visible-subslides.beginning <= idx
Expand Down

0 comments on commit 0e9dfb2

Please sign in to comment.