mirror of
https://gitea.com/gitea/tea.git
synced 2024-09-15 04:28:11 -04:00
89e93d90b3
Merge branch 'master' into use-glamour select Glamour Theme based on BackgroundColor Merge branch 'master' into use-glamour Merge branch 'master' into use-glamour update termev update go.mod label color colorate use glamour for issue content Vendor: Add glamour Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/181 Reviewed-by: techknowlogick <techknowlogick@gitea.io> Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
26 lines
757 B
Go
26 lines
757 B
Go
package colorful
|
|
|
|
import (
|
|
"math/rand"
|
|
)
|
|
|
|
// Uses the HSV color space to generate colors with similar S,V but distributed
|
|
// evenly along their Hue. This is fast but not always pretty.
|
|
// If you've got time to spare, use Lab (the non-fast below).
|
|
func FastWarmPalette(colorsCount int) (colors []Color) {
|
|
colors = make([]Color, colorsCount)
|
|
|
|
for i := 0; i < colorsCount; i++ {
|
|
colors[i] = Hsv(float64(i)*(360.0/float64(colorsCount)), 0.55+rand.Float64()*0.2, 0.35+rand.Float64()*0.2)
|
|
}
|
|
return
|
|
}
|
|
|
|
func WarmPalette(colorsCount int) ([]Color, error) {
|
|
warmy := func(l, a, b float64) bool {
|
|
_, c, _ := LabToHcl(l, a, b)
|
|
return 0.1 <= c && c <= 0.4 && 0.2 <= l && l <= 0.5
|
|
}
|
|
return SoftPaletteEx(colorsCount, SoftPaletteSettings{warmy, 50, true})
|
|
}
|