style

package
v1.36.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package style is how Probe shows a status in a terminal: its icon and its color. Probe prints a run with it, and an action can write what it reports under its step with it, so that a status looks the same there as in the rest of the run.

An action runs in a process of its own, whose standard output is not the terminal, so it would print no color by itself. Probe sets PROBE_TTY to 1 in the environment of the action when it prints to a terminal, and a mark is colored then, as it is when FORCE_COLOR is 1.

fmt.Fprintf(&b, "%s %s\n", style.Success, "the page shows the name")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Colored

func Colored() bool

Colored tells whether what is printed is colored: when FORCE_COLOR or PROBE_TTY is 1, and otherwise when color.NoColor is false, as it is when the standard output of the process is a terminal and NO_COLOR is not set.

Types

type Mark

type Mark int

Mark is a status as Probe shows it.

const (
	// Success is what passed: a green ✓.
	Success Mark = iota
	// Failure is what failed: a red ✗.
	Failure
	// NoTest is what ran with nothing to check it: a blue △.
	NoTest
	// Skipped is what was not run: a blue ⏭.
	Skipped
	// Warning is what did not fail but should be looked into: a yellow ⚠︎.
	Warning
	// Info is what is told for the reader to know: a blue ⏺.
	Info
)

func NoteLevel

func NoteLevel(level string) Mark

NoteLevel is the Mark of a note of level, as actionrpc names the levels: Failure for "critical", Warning for "warning" and Info for "info". A level that is none of these is Warning.

func (Mark) Color

func (m Mark) Color() *color.Color

Color is the color of m, yellow for a Mark that is none of the above. It colors what it prints by color.NoColor, as Probe's own printer, which sets it, does; Paint and String color by Colored.

func (Mark) Icon

func (m Mark) Icon() string

Icon is the icon of m, without color, or "?" for a Mark that is none of the above.

func (Mark) Paint

func (m Mark) Paint(s string) string

Paint is s in the color of m when Colored, and s as it is otherwise.

func (Mark) String

func (m Mark) String() string

String is the icon of m in its color when Colored.

Jump to

Keyboard shortcuts

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