ansi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ansi provides minimal ANSI escape code helpers for terminal rendering.

Index

Constants

View Source
const (
	Black   = "�[30m"
	Red     = "�[31m"
	Green   = "�[32m"
	Yellow  = "�[33m"
	Blue    = "�[34m"
	Magenta = "�[35m"
	Cyan    = "�[36m"
	White   = "�[37m"

	BrightBlack   = "�[90m"
	BrightRed     = "�[91m"
	BrightGreen   = "�[92m"
	BrightYellow  = "�[93m"
	BrightBlue    = "�[94m"
	BrightMagenta = "�[95m"
	BrightCyan    = "�[96m"
	BrightWhite   = "�[97m"
)

Color codes (foreground).

View Source
const Bold = "�[1m"

Bold text.

View Source
const ClearLine = "�[2K"

ClearLine erases the entire current line.

View Source
const ClearLineRight = "�[K"

ClearLineRight erases from cursor to end of line.

View Source
const HideCursor = "�[?25l"

HideCursor hides the terminal cursor.

View Source
const Reset = "�[0m"

Reset resets all terminal attributes.

View Source
const ShowCursor = "�[?25h"

ShowCursor shows the terminal cursor.

Variables

This section is empty.

Functions

func Colorize

func Colorize(color, text string) string

Colorize wraps text with a color code and reset.

func CursorColumn

func CursorColumn(n int) string

CursorColumn moves the cursor to column n (1-based).

func CursorDown

func CursorDown(n int) string

CursorDown moves the cursor down n lines.

func CursorUp

func CursorUp(n int) string

CursorUp moves the cursor up n lines.

func Truncate

func Truncate(s string, max int) string

Truncate truncates s to max runes, appending "…" if truncated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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