logo

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package logo prints the brigada logo in a terminal: the banner (the Blackfire flame beside the pixel wordmark), the flame alone and the one-line form from docs/brand/cli, with the flame core in hi-vis orange where the terminal can show it, and the fallbacks docs/brand/README.md sets for no color, no UTF-8 and narrow terminals.

Render is pure: it prints what the given Caps allow. Detect reads the environment and the terminal to fill those Caps.

Index

Constants

View Source
const (
	// BannerText is cli/banner.txt: the flame and the wordmark, 36 × 5
	// characters. Without color the flame core is left blank.
	BannerText = `` /* 270-byte string literal not displayed */

	// MarkText is cli/mark.txt: the flame alone, 7 × 5 characters.
	MarkText = `   ▄█
▄  ███
██▄▀███
██   ██
▀█▄▄▄█▀
`
	// OneLineText is cli/oneline.txt, for status lines and logs.
	OneLineText = "▙ brigada\n"
	// ASCIIText is cli/ascii.txt, for terminals without UTF-8.
	ASCIIText = `|_   _  .  _   _   _|  _
|_) |   | (_| (_| (_| (_|
           _|
`
)

The texts below are copies of docs/brand/cli/*.txt, byte for byte (a test checks it). go:embed cannot reach docs/ from this package.

View Source
const (
	BannerWidth  = 36
	MarkWidth    = 7
	OneLineWidth = 9
	ASCIIWidth   = 25
	// MinWidth is the narrowest terminal that gets the banner or the mark;
	// a narrower one gets the one-line form.
	MinWidth = 37
)

Widths of the texts in terminal columns.

Variables

This section is empty.

Functions

func Render

func Render(w io.Writer, form Form, caps Caps) error

Render writes form to w as caps allow:

  • without UTF-8, the banner and the mark print as ASCIIText when it fits, and nothing prints otherwise; the one-line form, which has no ASCII version, prints nothing;
  • narrower than MinWidth, the banner and the mark print as the one-line form;
  • with color, the flame core (coreCells in the banner and the mark) prints on a hi-vis background: the half blocks there keep the terminal's own foreground for the flame body and show orange in their other half, and the blanks turn orange; the ▙ of the one-line form prints in hi-vis; every other cell keeps the default foreground;
  • with NoColor, the texts print as they are, the core left blank.

func String

func String(form Form, caps Caps) string

String returns what Render would write.

Types

type Caps

type Caps struct {
	// TTY is whether the output is a terminal. Render ignores it; callers
	// use it to leave the logo out of output that scripts read.
	TTY bool
	// Color is the color depth; NoColor prints no escape codes.
	Color Depth
	// UTF8 is false when the locale is not UTF-8 or TERM is dumb.
	UTF8 bool
	// Width is the terminal width in columns; 0 means unknown.
	Width int
}

Caps is what the output can show.

func Detect

func Detect(w io.Writer) Caps

Detect fills Caps for output written to w, from the environment and, when w is a terminal, the terminal's size. Output that is not an *os.File on a terminal gets no color.

type Depth

type Depth int

Depth is how many colors the terminal shows.

const (
	NoColor Depth = iota
	Color16
	Color256
	TrueColor
)

type Form

type Form int

Form is the shape of the logo to print.

const (
	Mark
	OneLine
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL