Skip to content

Backgrounds

BlowBackground draws a dots, lines or cross pattern under the flow that pans and zooms with it. The toolbar drives its options - spacing per axis, dot and cross size, stroke width, offset, colour and a solid backdrop - and a second background stacked under the first turns the pattern into a grid with dots in it.

Node 1
Node 2
Node 3
bit Blow

Try it

  • Pick a Variant: Dots, Lines or Cross.
  • Drag Gap to space the pattern closer or further apart, and tick Rows twice as far apart to space the vertical axis on its own.
  • Drag Size to grow the dots or the arms of the crosses, and Line width to thicken the lines and crosses; each is off for the variant it does nothing to.
  • Drag Offset to slide the pattern against the nodes without moving them.
  • Switch Colour between the theme's pattern colour, a fixed grey and the accent colour applied by a CSS class.
  • Tick Backdrop to paint a solid colour behind the pattern, and Grid underneath to stack a coarse grid of lines under it.
  • Drag the background to pan and scroll to zoom: the pattern travels and scales with the nodes, and stays crisp at any zoom.

How it works

  • BlowBackground goes inside the canvas. It is drawn in screen space from the current viewport, so it follows every pan and zoom without blurring.
  • Variant (default Dots) picks the shape; Gap (20) is the spacing in flow units, and GapX and GapY override one axis each - the rows box sets GapY to twice the gap.
  • Size is the dot diameter or the cross arm length; left unset it is 1 for dots and 6 for crosses, which is where the slider starts each time you switch variant. LineWidth (1) is the stroke of lines and crosses.
  • OffsetX and OffsetY (0) shift the pattern in flow units on top of the viewport's own translation.
  • Color left unset takes --bit-blow-background-pattern, which follows the colour mode. PatternClass puts a class on the pattern's shape instead, so a stylesheet can colour it - here the dots' fill and the lines' stroke from --bit-blow-node-selected. Class and Style do the same for the background's container.
  • BgColor (transparent) paints a solid colour behind the pattern - here --bit-blow-surface-muted, so it changes with the colour mode too.
  • Backgrounds stack: each is its own layer, painted in the order written. The grid is a Lines background with four times the gap, placed before the pattern so it lies under it.
  • FitViewOptions caps the first fit at a zoom of 1, so a gap of 20 is 20 pixels on screen when the page opens.
An unhandled error has occurred. Reload 🗙