Improved LCH support

This commit is contained in:
2024-03-06 19:23:49 +01:00
parent 30838ca0b6
commit dae9993a96
5 changed files with 173 additions and 80 deletions

View File

@ -5,7 +5,7 @@ Adds color to your terminal output.
## Features
- RGB color space
- OKLCH color space
- LCH color space (oklch)
- Truecolor terminal output
## Installation
@ -19,14 +19,20 @@ go get git.akyoto.dev/go/color
```go
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: TestNoColors
PASS: TestColors
PASS: TestRainbow
PASS: TestFprint
PASS: TestPrint
PASS: TestPrintln
PASS: TestRGB
PASS: TestLCH
PASS: TestLCHSpectrum
coverage: 100.0% of statements
```
@ -34,7 +40,7 @@ coverage: 100.0% of statements
```
BenchmarkRGB-12 1000000000 0.3132 ns/op 0 B/op 0 allocs/op
BenchmarkLCH-12 11214220 107.1 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
```