colors

package module
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 1 Imported by: 0

README

A package for ANSI color formatting

GitHub tag (latest SemVer pre-release) GitHub go.mod Go version GitHub Workflow Status Go Report Card PkgGoDev

Introduction

  • ANSI color formatting for consoles
  • No dependencies outside the standard library

Example

package main

import (
	"fmt"

	"github.com/gofor-little/colors"
)

func main() {
	fmt.Println(colors.Black("Black"))
	fmt.Println(colors.BlackBright("BlackBright"))
	fmt.Println(colors.Red("Red"))
	fmt.Println(colors.RedBright("RedBright"))
	fmt.Println(colors.Green("Green"))
	fmt.Println(colors.GreenBright("GreenBright"))
	fmt.Println(colors.Yellow("Yellow"))
	fmt.Println(colors.YellowBright("YellowBright"))
	fmt.Println(colors.Blue("Blue"))
	fmt.Println(colors.BlueBright("BlueBright"))
	fmt.Println(colors.Magenta("Magenta"))
	fmt.Println(colors.MagentaBright("MagentaBright"))
	fmt.Println(colors.Cyan("Cyan"))
	fmt.Println(colors.CyanBright("CyanBright"))
	fmt.Println(colors.White("White"))
	fmt.Println(colors.WhiteBright("WhiteBright"))
}

Testing

Run go test ./... in the root directory.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Black         = Color("\033[1;30m%s\033[0m")
	BlackBright   = Color("\033[1;90m%s\033[0m")
	Red           = Color("\033[1;31m%s\033[0m")
	RedBright     = Color("\033[1;91m%s\033[0m")
	Green         = Color("\033[1;32m%s\033[0m")
	GreenBright   = Color("\033[1;92m%s\033[0m")
	Yellow        = Color("\033[1;33m%s\033[0m")
	YellowBright  = Color("\033[1;93m%s\033[0m")
	Blue          = Color("\033[1;34m%s\033[0m")
	BlueBright    = Color("\033[1;94m%s\033[0m")
	Magenta       = Color("\033[1;35m%s\033[0m")
	MagentaBright = Color("\033[1;95m%s\033[0m")
	Cyan          = Color("\033[1;36m%s\033[0m")
	CyanBright    = Color("\033[1;96m%s\033[0m")
	White         = Color("\033[1;37m%s\033[0m")
	WhiteBright   = Color("\033[1;97m%s\033[0m")
)

Available colors.

Functions

func Color

func Color(ansiColorCode string) func(...interface{}) string

Color formats the ANSI color code with the passed args.

Types

This section is empty.

Jump to

Keyboard shortcuts

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