Setting up headers in Touying

Hi guys. I am trying to setup Touying based on an internal .pptx template so I can (hopefully) more easily produce slides.

This template is very simple, but I am having a lot of trouble adjusting the simple theme to be compatible with it. Essentially it consists of a header with the slide title in bold justified to the left, the slide number justified to the right in neutral colors, and a colored bar on the bottom. The slide should have no margin whatsoever.

The first slide essentially requires a header with three images justified to the left, with the title and subtitle on the center. The latter is already given by simple theme but that is about it.

Essentially, it should look like this:


But so far I could only get the code below. Sorry, I can’t show what it renders because the forums only allows two figure uploads.

#import "@preview/touying:0.6.3": *
#import themes.simple: *

#let red = rgb("#ff0000")//rgb("#391881")
// #let container = rect.with(height: 100%, width: 100%, inset: 0pt)
// #let innerbox = rect.with(stroke: (dash: "dashed"))

#let header(self) = {
  set align(top)
  // show: components.cell.with(fill: self.colors.primary, inset: 1em)
  // set align(horizon)
  set text(fill: rgb("#000000"), 
    size: 2.5em, 
    weight: "bold"
  )
  utils.display-current-heading(level:2)
  context utils.slide-counter.display()

  linebreak()
  
  // purple line
  line(
    length: 100%,
    stroke: (
      paint: red,
      thickness: 3pt
    )
  )
}


#show: simple-theme.with(aspect-ratio: "16-9",
header: header,
config-page(
   margin: (top: 0em, bottom: 0em, x: 0em)
  ))


= Title
Subtitle

== Slide 1
Content 1

== Slide 2
Content2

Could someone explain to me what I am doing wrong and how can I fix this? It would make my day.

These are the slides I have managed to make thus far:


Hi. Here is how I’d probably do it:

#import "@preview/touying:0.6.3": *
#import themes.simple: *

// #let red = rgb("#ff0000") // rgb("#391881")
#let red = rgb("#ff0404") // rgb("#391881")

#let header(self) = {
  {
    show: components.cell.with(inset: 5mm)
    text(2.5em, strong(utils.display-current-heading()))
    h(1fr)
    show: box
    show: move.with(dx: 0.5em, dy: 0.5em)
    context utils.slide-counter.display()
  }
  line(length: 100%, stroke: red + 3pt)
}

#let title-background = {
  set align(top + left)
  set rect(stroke: blue.lighten(50%) + 4pt)
  show: pad.with(2pt)
  grid(
    columns: 3,
    gutter: 5mm,
    align: bottom,
    rect(width: 40mm, height: 30mm),
    rect(width: 37mm, height: 27mm),
    rect(width: 35mm, height: 25mm),
  )
}

#show: simple-theme.with(
  header: header,
  footer-right: none,
  subslide-preamble: none,
  config-info(title: "Title"),
  config-page(margin: (top: 3em, rest: 5mm), fill: gray.lighten(50%)),
  config-common(zero-margin-header: true, zero-margin-footer: true),
  config-colors(primary: black),
)
#set text(font: "Liberation Sans")

#title-slide(config: config-page(background: title-background))[
  #title()
  Subtitle
]

== Slide 1
#lorem(98)

== Slide 2
#lorem(98)

This is not how it works, nor how presentations work in general. You clearly have some padding around all text boxes and just in general for the main slide text. This contradicts with your reproduction goal.