Trying to render a percentage bar

A block in a block is another way

#let progress(percent, height: 100%, width: 100%, bg: gray, fg: blue, stroke: 1pt) = {
  block(height: height, width: width, stroke: stroke, fill: bg, {
    block(height: height, width: width * percent, fill: fg, stroke: stroke)
  })
}

#progress(37%, width: 200pt, height: 30pt)
#progress(75%, width: 200pt, height: 30pt)

You can also draw filled shapes with curve, or even with the package cetz, so there are many ways to do it.

4 Likes