Skip to content

Commit a472fc2

Browse files
committed
doc: don't allow hue 360 for hsv/hsl (#71)
1 parent 14c881f commit a472fc2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ but only releases after v1.0.3 properly adhere to it.
1818

1919
### Fixed
2020
- Fix bug when doing HSV/HCL blending between a gray color and non-gray color (#60)
21+
- Docs for HSV/HSL were updated to note that hue 360 is not allowed (#71)
2122

2223
### Deprecated
2324
- `DistanceLinearRGB` is deprecated for the name `DistanceLinearRgb` which is more in-line with the rest of the library

colors.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ func interp_angle(a0, a1, t float64) float64 {
154154
/// HSV ///
155155
///////////
156156
// From http://en.wikipedia.org/wiki/HSL_and_HSV
157-
// Note that h is in [0..360] and s,v in [0..1]
157+
// Note that h is in [0..359] and s,v in [0..1]
158158

159-
// Hsv returns the Hue [0..360], Saturation and Value [0..1] of the color.
159+
// Hsv returns the Hue [0..359], Saturation and Value [0..1] of the color.
160160
func (col Color) Hsv() (h, s, v float64) {
161161
min := math.Min(math.Min(col.R, col.G), col.B)
162162
v = math.Max(math.Max(col.R, col.G), col.B)
@@ -186,7 +186,7 @@ func (col Color) Hsv() (h, s, v float64) {
186186
return
187187
}
188188

189-
// Hsv creates a new Color given a Hue in [0..360], a Saturation and a Value in [0..1]
189+
// Hsv creates a new Color given a Hue in [0..359], a Saturation and a Value in [0..1]
190190
func Hsv(H, S, V float64) Color {
191191
Hp := H / 60.0
192192
C := V * S
@@ -238,7 +238,7 @@ func (c1 Color) BlendHsv(c2 Color, t float64) Color {
238238
/// HSL ///
239239
///////////
240240

241-
// Hsl returns the Hue [0..360], Saturation [0..1], and Luminance (lightness) [0..1] of the color.
241+
// Hsl returns the Hue [0..359], Saturation [0..1], and Luminance (lightness) [0..1] of the color.
242242
func (col Color) Hsl() (h, s, l float64) {
243243
min := math.Min(math.Min(col.R, col.G), col.B)
244244
max := math.Max(math.Max(col.R, col.G), col.B)
@@ -273,7 +273,7 @@ func (col Color) Hsl() (h, s, l float64) {
273273
return
274274
}
275275

276-
// Hsl creates a new Color given a Hue in [0..360], a Saturation [0..1], and a Luminance (lightness) in [0..1]
276+
// Hsl creates a new Color given a Hue in [0..359], a Saturation [0..1], and a Luminance (lightness) in [0..1]
277277
func Hsl(h, s, l float64) Color {
278278
if s == 0 {
279279
return Color{l, l, l}
@@ -1130,4 +1130,3 @@ func (col1 Color) BlendOkLch(col2 Color, t float64) Color {
11301130
// We know that h are both in [0..360]
11311131
return OkLch(l1+t*(l2-l1), c1+t*(c2-c1), interp_angle(h1, h2, t)).Clamped()
11321132
}
1133-

0 commit comments

Comments
 (0)