🌈 Adds color to your terminal output. 7 Commits
2024-03-11 22:09:45 +01:00
.gitignore Initial commit 2024-03-05 17:47:02 +01:00
Benchmarks_test.go Improved interface 2024-03-11 22:08:28 +01:00
Color_test.go Improved interface 2024-03-11 22:08:28 +01:00
Color.go Improved interface 2024-03-11 22:08:28 +01:00
go.mod Initial commit 2024-03-05 17:47:02 +01:00
go.sum Initial commit 2024-03-05 17:47:02 +01:00
LCH_test.go Improved LCH support 2024-03-06 19:23:49 +01:00
LCH.go Improved LCH support 2024-03-06 19:23:49 +01:00
README.md Added missing test case 2024-03-11 22:09:45 +01:00
sRGB.go Improved LCH support 2024-03-06 19:23:49 +01:00
Terminal.go Improved interface 2024-03-11 22:08:28 +01:00

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: TestPrintf
PASS: TestPrintln
PASS: TestRGB
PASS: TestLCH
PASS: TestLCHSpectrum
coverage: 100.0% of statements

Benchmarks

BenchmarkRGB-12                 1000000000               0.3211 ns/op          0 B/op          0 allocs/op
BenchmarkLCH-12                  4767306               251.8 ns/op             0 B/op          0 allocs/op
BenchmarkFprint-12               4869368               245.7 ns/op             0 B/op          0 allocs/op
BenchmarkFprintRaw-12           23155356                43.73 ns/op            0 B/op          0 allocs/op
BenchmarkPrint-12                 358099              3560 ns/op               0 B/op          0 allocs/op
BenchmarkPrintRaw-12             3144412               378.9 ns/op             0 B/op          0 allocs/op

License

Please see the license documentation.

© 2024 Eduard Urbach