gocolors

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 2 Imported by: 0

README

gocolors

Gocolors is a color library for Go (golang), which works along the standard library fmt and log packages. It can render text in a wide variety of colors giving your programs a much more outstanding output.

Gocolors output

Roadmap

  • 8 bit color rendering
  • 16 bit color rendering
  • Implement tests
  • Documentation
  • CI workflow

The following ideas should be included in further releases, but the intentions are to have all this features added in the first stable version of the gocolors color library.

Important note This project is still in its early stages so expect breaking changes in the API, experiment, play and contribute but don't use it in production code or something that is serious enough.

Gocolors Version 1.0.0
  • 256 bit, RGB and True colors support
  • File separation between color types
  • Custom built color
  • Option to plug in with the standard library fmt or log

Examples

You can start using the color library just by printing something:

package main

import (
	color "github.com/ksrof/gocolors"
)

func main() {
	// The Color method takes three parameters, the first is the
	// content that is going to be printed, the second is the color
	// and the third is the decoration.
	fmt.Println(color.Color("This should be underlined and green", "green", "underline"))
}

As you see it is pretty easy to use, but still there's a lot of room to improve!

License

The MIT License (MIT) - see license for more details.

Documentation

Index

Constants

View Source
const (
	Reset = "\u001b[0m"
)

8 Bit colors

Variables

This section is empty.

Functions

func Black

func Black(content, decoration string) string

Black returns a string rendered in black.

func Blue

func Blue(content, decoration string) string

Blue returns a string rendered in blue.

func BrightBlack

func BrightBlack(content, decoration string) string

BrightBlack returns a string rendered in bright black.

func BrightBlue

func BrightBlue(content, decoration string) string

BrightBlue returns a string rendered in bright blue.

func BrightColor

func BrightColor(content, color, decoration string) string

BrightColor returns a string rendered with the given color.

func BrightCyan

func BrightCyan(content, decoration string) string

BrightCyan returns a string rendered in bright cyan.

func BrightGreen

func BrightGreen(content, decoration string) string

BrightGreen returns a string rendered in bright green.

func BrightMagenta

func BrightMagenta(content, decoration string) string

BrightMagenta returns a string rendered in bright magenta.

func BrightRed

func BrightRed(content, decoration string) string

BrightRed returns a string rendered in bright red.

func BrightWhite

func BrightWhite(content, decoration string) string

BrightWhite returns a string rendered in bright white.

func BrightYellow

func BrightYellow(content, decoration string) string

BrightYellow returns a string rendered in bright yellow.

func Color

func Color(content, color, decoration string) string

Color returns a string rendered with the given color.

func Cyan

func Cyan(content, decoration string) string

Cyan returns a string rendered in cyan.

func Green

func Green(content, decoration string) string

Green returns a string rendered in green.

func Magenta

func Magenta(content, decoration string) string

Magenta returns a string rendered in magenta.

func Red

func Red(content, decoration string) string

Red returns a string rendered in red.

func White

func White(content, decoration string) string

White returns a string rendered in white.

func Yellow

func Yellow(content, decoration string) string

Yellow returns a string rendered in yellow.

Types

This section is empty.

Jump to

Keyboard shortcuts

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