I’m using a Typst template and I’m trying to customize the buaa-navigation-bar. The template imports libraries using @preview as shown below:
#import "@preview/touying:0.4.2": *
#import "@preview/touying-buaa:0.1.0" as buaa-theme
#let s = buaa-theme.register()
The original buaa-navigation-bar is defined in the lib.typ file from the buaa-theme library as follows:
self.buaa-navigation = self => {
grid(
align: center + horizon,
columns: (1fr, auto, auto),
rows: 1.8em,
components.cell(fill: self.colors.neutral-darkest, buaa-nav-bar(self: self)),
block(fill: self.colors.neutral-darkest, inset: 4pt, height: 100%, image("assets/vi/buaa-logo.svg")),
)
}
I want to customize this navigation bar to include additional items and change the colors. How can I properly override or customize the buaa-navigation-bar using the Typst template with @preview imports?
I tried the following in my main.typ file, but it doesn’t seem to work:
#override buaa-theme.buaa-navigation = self => {
grid(
align: center + horizon,
columns: (1fr, auto, auto, auto), // Adjust columns as needed
rows: 1.8em,
components.cell(fill: self.colors.primary, buaa-theme.buaa-nav-bar(self: self)), // Change color
block(fill: self.colors.primary, inset: 4pt, height: 100%, image("assets/vi/new-logo.svg")), // New logo
block(fill: self.colors.primary, inset: 4pt, height: 100%, text("Home")), // New item
block(fill: self.colors.primary, inset: 4pt, height: 100%, text("About")), // Another item
)
}
@preview buaa-theme.buaa-navigation(s)
Robert k Samuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.