terminal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: BSD-3-Clause, ISC, MIT Imports: 2 Imported by: 0

Documentation

Overview

Package terminal provides the functions and constants required for 256 color terminal output and the conversion of color.Color structs to ColorCode

Index

Constants

View Source
const (
	// Reset terminal colors
	Reset = "\033[0m"
	// Clear terminal
	Clear = "\033[2J"
	// Move the cursor to 0,0
	Origin = "\033[0;0H"
)

Variables

View Source
var (
	// ColorMap - Maps 256 color terminal codes to color.RGBA
	ColorMap = map[ColorCode]color.RGBA{}/* 240 elements not displayed */

	TermPalette, ColorLookup = createTermPalette() //nolint:golint,golint
)

Functions

func Bg

func Bg(i ColorCode, s string) string

Returns string s with ColorCode i applied to the background

func Fg

func Fg(i ColorCode, s string) string

Returns string s with ColorCode i applied to the foreground

Types

type ColorCode

type ColorCode uint8

func FindColorCode

func FindColorCode(c color.Color) ColorCode

Finds the closest ColorCode to color.Color c and returns it. If color.Color s is transparent, returns 0

Jump to

Keyboard shortcuts

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