diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-05-25 22:44:12 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-05-25 22:44:12 +0300 |
commit | 7b8229dab12ddfe34b91a6eccce7744db17d398a (patch) | |
tree | b569a2c085e2cbaab1975497500a1dd9001e7ba8 /vendor/github.com/lucasb-eyer/go-colorful/colorgens.go | |
parent | a76ce88a30e8c09603350a88827cf24239e8e44a (diff) |
Update dependencies
Diffstat (limited to 'vendor/github.com/lucasb-eyer/go-colorful/colorgens.go')
-rw-r--r-- | vendor/github.com/lucasb-eyer/go-colorful/colorgens.go | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go b/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go index 1c5e4ca..2e2e49e 100644 --- a/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go +++ b/vendor/github.com/lucasb-eyer/go-colorful/colorgens.go @@ -3,52 +3,53 @@ package colorful import ( - "math/rand" + "math/rand" ) // Creates a random dark, "warm" color through a restricted HSV space. func FastWarmColor() Color { - return Hsv( - rand.Float64() * 360.0, - 0.5 + rand.Float64()*0.3, - 0.3 + rand.Float64()*0.3) + 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 WarmColor() (c Color) { - for c = randomWarm() ; !c.IsValid() ; c = randomWarm() {} - return + for c = randomWarm(); !c.IsValid(); c = randomWarm() { + } + return } func randomWarm() Color { - return Hcl( - rand.Float64() * 360.0, - 0.1 + rand.Float64()*0.3, - 0.2 + rand.Float64()*0.3) + 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 FastHappyColor() Color { - return Hsv( - rand.Float64() * 360.0, - 0.7 + rand.Float64()*0.3, - 0.6 + rand.Float64()*0.3) + 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 HappyColor() (c Color) { - for c = randomPimp() ; !c.IsValid() ; c = randomPimp() {} - return + for c = randomPimp(); !c.IsValid(); c = randomPimp() { + } + return } func randomPimp() Color { - return Hcl( - rand.Float64() * 360.0, - 0.5 + rand.Float64()*0.3, - 0.5 + rand.Float64()*0.3) + return Hcl( + rand.Float64()*360.0, + 0.5+rand.Float64()*0.3, + 0.5+rand.Float64()*0.3) } - |