1.0 KiB

color

Adds color to your terminal output.

Features

  • RGB color space
  • LCH color space (oklch)
  • Truecolor terminal output
  • Zero dependencies (excluding tests)

Installation

go get git.akyoto.dev/go/color

Usage

red := color.RGB(1.0, 0.0, 0.0)
red.Println("red text")

orange := color.LCH(0.7, 1.0, 65)
orange.Println("orange text")

Tests

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

Benchmarks

BenchmarkRGB-12                	1000000000	         0.3132 ns/op	   0 B/op	       0 allocs/op
BenchmarkLCH-12                	 4802006	       249.8 ns/op	       0 B/op	       0 allocs/op
BenchmarkFprintColorized-12    	 6356535	       188.4 ns/op	       0 B/op	       0 allocs/op
BenchmarkFprintRaw-12          	27374659	        43.76 ns/op	       0 B/op	       0 allocs/op

License

Please see the license documentation.

© 2024 Eduard Urbach