Separators and Spacing

Termline includes small helpers for blank lines and visual separators.

Termline.br(count = 1)
Termline.line(character: "─", width: nil)
Termline.color(:red)

Blank Lines

Termline.br
Termline.br(3)

br prints one or more newline characters.

Adaptive Separators

line fills the current terminal width by default:

Termline.line

For a 20-column output, this renders:

────────────────────

Choose another character or an explicit width:

Termline.line(character: "=")
Termline.line(character: "·-", width: 40)

Multi-character patterns are repeated and cropped to the requested width.

Background Color Bars

Use color to print a terminal-width background bar:

Termline.color(:red)

The helper accepts colors from Termline::Style::BG_COLORS. It produces no output when ANSI styling is disabled, including non-interactive output in the default :auto mode.

Compatibility

The previous positional count remains supported:

Termline.line(3)

It renders the original -·- pattern three times. Prefer the adaptive keyword API for new code.

Builder API

Builders return strings without writing them:

Termline::Space.builder("\n", 2)
Termline::Space.line("─", 40)

Public helpers write to Termline.output, which defaults to $stdout.

 Edit this page

Last Update: 2026/10/19