co

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MIT Imports: 5 Imported by: 0

README

co

The library for terminal output formatting with ANSI colors

Install

$ go get -u github.com/Binbiubiubiu/co

Example

package main

import (
	. "github.com/Binbiubiubiu/co"
)

func main() {
	println(GreenBright("Hello"), BgCyanBright(RedBright("Binbiubiubiu")))
}

Thanks

colorette 🌈Easily set your terminal text color & styles.

Documentation

Index

Constants

View Source
const IS_WINDOWS = runtime.GOOS == "windows"

Variables

View Source
var BgBlack = build(40, 49)
View Source
var BgBlackBright = build(100, 49)
View Source
var BgBlue = build(44, 49)
View Source
var BgBlueBright = build(104, 49)
View Source
var BgCyan = build(46, 49)
View Source
var BgCyanBright = build(106, 49)
View Source
var BgGreen = build(42, 49)
View Source
var BgGreenBright = build(102, 49)
View Source
var BgMagenta = build(45, 49)
View Source
var BgMagentaBright = build(105, 49)
View Source
var BgRed = build(41, 49)
View Source
var BgRedBright = build(101, 49)
View Source
var BgWhite = build(47, 49)
View Source
var BgWhiteBright = build(107, 49)
View Source
var BgYellow = build(43, 49)
View Source
var BgYellowBright = build(103, 49)
View Source
var Black = build(30, 39)
View Source
var BlackBright = build(90, 39)
View Source
var Blue = build(34, 39)
View Source
var BlueBright = build(94, 39)
View Source
var Bold = buildWithReplace(1, 22, "\x1b[22m\x1b[1m")
View Source
var Cyan = build(36, 39)
View Source
var Dim = buildWithReplace(2, 22, "\x1b[22m\x1b[2m")
View Source
var Gray = build(90, 39)
View Source
var Green = build(32, 39)
View Source
var GreenBright = build(92, 39)
View Source
var Hidden = build(8, 28)
View Source
var Inverse = build(7, 27)
View Source
var (
	IsColorSupported = !isDisabled &&
		(isForced || (IS_WINDOWS && !isDumbTerminal) || isCompatibleTerminal || isCI)
)
View Source
var Italic = build(3, 23)
View Source
var Magenta = build(35, 39)
View Source
var MagentaBright = build(95, 39)
View Source
var Red = build(31, 39)
View Source
var RedBrCyanBrightight = build(96, 39)
View Source
var RedBright = build(91, 39)
View Source
var Reset = build(0, 0)
View Source
var Strikethrough = build(9, 29)
View Source
var Underline = build(4, 24)
View Source
var White = build(37, 39)
View Source
var WhiteBright = build(97, 39)
View Source
var Yellow = build(33, 39)
View Source
var YellowBright = build(93, 39)

Functions

This section is empty.

Types

type ColorFunc

type ColorFunc func(string) string

Color formatting functions

type Colors

type Colors struct {
	Reset               ColorFunc
	Bold                ColorFunc
	Dim                 ColorFunc
	Italic              ColorFunc
	Underline           ColorFunc
	Inverse             ColorFunc
	Hidden              ColorFunc
	Strikethrough       ColorFunc
	Black               ColorFunc
	Red                 ColorFunc
	Green               ColorFunc
	Yellow              ColorFunc
	Blue                ColorFunc
	Magenta             ColorFunc
	Cyan                ColorFunc
	White               ColorFunc
	Gray                ColorFunc
	BgBlack             ColorFunc
	BgRed               ColorFunc
	BgGreen             ColorFunc
	BgYellow            ColorFunc
	BgBlue              ColorFunc
	BgMagenta           ColorFunc
	BgCyan              ColorFunc
	BgWhite             ColorFunc
	BlackBright         ColorFunc
	RedBright           ColorFunc
	GreenBright         ColorFunc
	YellowBright        ColorFunc
	BlueBright          ColorFunc
	MagentaBright       ColorFunc
	RedBrCyanBrightight ColorFunc
	WhiteBright         ColorFunc
	BgBlackBright       ColorFunc
	BgRedBright         ColorFunc
	BgGreenBright       ColorFunc
	BgYellowBright      ColorFunc
	BgBlueBright        ColorFunc
	BgMagentaBright     ColorFunc
	BgCyanBright        ColorFunc
	BgWhiteBright       ColorFunc
}

func CreateColors

func CreateColors() Colors

Create a color tool function

func UseColors

func UseColors(useColor bool) Colors

Create a color utility function with a useColor property

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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