Categorygithub.com/go-labx/color
modulepackage
0.0.1
Repository: https://github.com/go-labx/color.git
Documentation: pkg.go.dev

# README

color

The color library is used for outputting colored text in the console using ANSI escape sequences.

Installation

go get github.com/go-labx/color

Usage

To use this color lib, import it in your Go code:

import "github.com/go-labx/color"

Here is an example of how to use color:

package main

import (
	"fmt"
	"github.com/go-labx/color"
)

func main() {
	fmt.Println(color.BlackString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.RedString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.GreenString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.YellowString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.BlueString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.MagentaString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.CyanString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
	fmt.Println(color.WhiteString("username = %s age = %d city = %s", "Jack", 20, "Hangzhou"))
}

API Documentation

For detailed API documentation and usage examples, please refer to the documentation.

Contributing

Contributions are welcome! Please see CONTRIBUTING for more information.

License

color is licensed under the MIT License. See LICENSE for more information.

# Packages

No description provided by the author

# Functions

BlackString returns a black string.
BlueString returns a blue string.
CyanString returns a cyan string.
GreenString returns a green string.
IsTTY checks if the output is a TTY device.
MagentaString returns a magenta string.
RedString returns a red string.
WhiteString returns a white string.
YellowString returns a yellow string.

# Constants

Blinking font (rapid).
Blinking font (slow).
Bold font.
Concealed font (hidden).
Crossed-out font.
Faint font (decreased intensity).
Constants for foreground colors.
Constants for foreground colors.
Constants for foreground colors.
Constants for foreground colors.
Constants for foreground colors.
Constants for foreground colors.
Constants for foreground colors.
Constants for foreground colors.
Italic font.
Reset all attributes.
Inverse video (background becomes foreground and vice versa).
Underline font.

# Type aliases

Attribute represents a color or style attribute.