2024-03-05 16:47:02 +00:00
|
|
|
# color
|
|
|
|
|
|
|
|
Adds color to your terminal output.
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
2024-03-11 23:25:20 +00:00
|
|
|
- ANSI colors
|
|
|
|
- LCH colors
|
|
|
|
- RGB colors
|
2024-03-05 16:47:02 +00:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
|
|
```shell
|
|
|
|
go get git.akyoto.dev/go/color
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
```go
|
2024-03-12 14:23:08 +00:00
|
|
|
// ANSI
|
|
|
|
ansi.Red.Println("red text")
|
2024-03-06 18:23:49 +00:00
|
|
|
|
2024-03-12 14:23:08 +00:00
|
|
|
// LCH
|
|
|
|
green := color.LCH(0.5, 1.0, 135)
|
|
|
|
green.Println("green text")
|
|
|
|
|
|
|
|
// RGB
|
|
|
|
blue := color.RGB(0, 0, 1)
|
|
|
|
blue.Println("blue text")
|
2024-03-05 16:47:02 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
|
|
|
```
|
2024-03-06 18:23:49 +00:00
|
|
|
PASS: TestPrint
|
2024-03-11 21:09:45 +00:00
|
|
|
PASS: TestPrintf
|
2024-03-06 18:23:49 +00:00
|
|
|
PASS: TestPrintln
|
|
|
|
PASS: TestLCH
|
|
|
|
PASS: TestLCHSpectrum
|
2024-03-12 14:23:08 +00:00
|
|
|
PASS: TestRGB
|
2024-03-05 16:47:02 +00:00
|
|
|
coverage: 100.0% of statements
|
|
|
|
```
|
|
|
|
|
|
|
|
## Benchmarks
|
|
|
|
|
|
|
|
```
|
2024-03-11 23:25:20 +00:00
|
|
|
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
|
2024-03-05 16:47:02 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
|
|
Please see the [license documentation](https://akyoto.dev/license).
|
|
|
|
|
|
|
|
## Copyright
|
|
|
|
|
|
|
|
© 2024 Eduard Urbach
|