Source File
colorgens.go
Belonging Package
github.com/lucasb-eyer/go-colorful
// Various ways to generate single random colorspackage colorfulimport ()// Creates a random dark, "warm" color through a restricted HSV space.func () Color {return Hsv(rand.Float64()*360.0,0.5+rand.Float64()*0.3,0.3+rand.Float64()*0.3)}// Creates a random dark, "warm" color through restricted HCL space.// This is slower than FastWarmColor but will likely give you colors which have// the same "warmness" if you run it many times.func () ( Color) {for = randomWarm(); !.IsValid(); = randomWarm() {}return}func randomWarm() Color {return Hcl(rand.Float64()*360.0,0.1+rand.Float64()*0.3,0.2+rand.Float64()*0.3)}// Creates a random bright, "pimpy" color through a restricted HSV space.func () Color {return Hsv(rand.Float64()*360.0,0.7+rand.Float64()*0.3,0.6+rand.Float64()*0.3)}// Creates a random bright, "pimpy" color through restricted HCL space.// This is slower than FastHappyColor but will likely give you colors which// have the same "brightness" if you run it many times.func () ( Color) {for = randomPimp(); !.IsValid(); = randomPimp() {}return}func randomPimp() Color {return Hcl(rand.Float64()*360.0,0.5+rand.Float64()*0.3,0.5+rand.Float64()*0.3)}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |