2024-03-12 15:23:08 +01:00

1.0 KiB

color

Adds color to your terminal output.

Features

  • ANSI colors
  • LCH colors
  • RGB colors

Installation

go get git.akyoto.dev/go/color

Usage

// ANSI
ansi.Red.Println("red text")

// LCH
green := color.LCH(0.5, 1.0, 135)
green.Println("green text")

// RGB
blue := color.RGB(0, 0, 1)
blue.Println("blue text")

Tests

PASS: TestPrint
PASS: TestPrintf
PASS: TestPrintln
PASS: TestLCH
PASS: TestLCHSpectrum
PASS: TestRGB
coverage: 100.0% of statements

Benchmarks

BenchmarkRGB-12                 1000000000               0.3141 ns/op          0 B/op          0 allocs/op
BenchmarkLCH-12                  4780176               250.9 ns/op             0 B/op          0 allocs/op
BenchmarkPrint-12                 375394              3343 ns/op               0 B/op          0 allocs/op
BenchmarkPrintRaw-12             3105022               387.3 ns/op             0 B/op          0 allocs/op

License

Please see the license documentation.

© 2024 Eduard Urbach