🌈 Adds color to your terminal output.
11 Commits
Eduard Urbach 082164c2a1
Added ANSI colors for old terminals
2024-03-21 23:23:43 +01:00
ansi Added more tests 2024-03-12 15:23:08 +01:00
tty Added more tests 2024-03-12 15:23:08 +01:00
.gitignore Initial commit 2024-03-05 17:47:02 +01:00
Benchmarks_test.go Added terminal detection 2024-03-12 00:25:20 +01:00
Color_test.go Added more tests 2024-03-12 15:23:08 +01:00
Color.go Added ANSI colors for old terminals 2024-03-21 23:23:43 +01:00
go.mod Added terminal detection 2024-03-12 00:25:20 +01:00
go.sum Added terminal detection 2024-03-12 00:25:20 +01:00
LCH_test.go Added more tests 2024-03-12 15:23:08 +01:00
LCH.go Improved LCH support 2024-03-06 19:23:49 +01:00
README.md Added more tests 2024-03-12 15:23:08 +01:00
RGB_test.go Added more tests 2024-03-12 15:23:08 +01:00
RGB.go Added more tests 2024-03-12 15:23:08 +01:00
Terminal.go Added ANSI colors for old terminals 2024-03-21 23:23:43 +01:00
Value.go Added more tests 2024-03-12 15:23:08 +01:00

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