Skip to content

Commit f3acf8a

Browse files
committed
remove unused codes
1 parent 91e6281 commit f3acf8a

File tree

3 files changed

+1
-60
lines changed

3 files changed

+1
-60
lines changed

go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ module github.com/mazznoer/colorgrad
22

33
go 1.17
44

5-
require (
6-
github.com/lucasb-eyer/go-colorful v1.2.0
7-
github.com/mazznoer/csscolorparser v0.1.5-0.20240719031628-b1c13f071417
8-
)
5+
require github.com/mazznoer/csscolorparser v0.1.5-0.20240719031628-b1c13f071417

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
2-
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
3-
github.com/mazznoer/csscolorparser v0.1.4 h1:1bAWPWdoMc5qdAXVlixS9rpZLw/vaq5InX/lj3tfRQQ=
4-
github.com/mazznoer/csscolorparser v0.1.4/go.mod h1:OQRVvgCyHDCAquR1YWfSwwaDcM0LhnSffGnlbOew/3I=
5-
github.com/mazznoer/csscolorparser v0.1.5-0.20240717073837-ced1c0227ecd h1:QD8NhwDjRqslqCti93tzxSjojvNUihcaYqQjGwdQAcM=
6-
github.com/mazznoer/csscolorparser v0.1.5-0.20240717073837-ced1c0227ecd/go.mod h1:OQRVvgCyHDCAquR1YWfSwwaDcM0LhnSffGnlbOew/3I=
71
github.com/mazznoer/csscolorparser v0.1.5-0.20240719031628-b1c13f071417 h1:IdwaaP9b9TX6x7pMASy55IiksNPm73Z64ru71Nx22bw=
82
github.com/mazznoer/csscolorparser v0.1.5-0.20240719031628-b1c13f071417/go.mod h1:OQRVvgCyHDCAquR1YWfSwwaDcM0LhnSffGnlbOew/3I=

util.go

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import (
44
"math"
55
"strconv"
66
"strings"
7-
8-
"github.com/lucasb-eyer/go-colorful"
97
)
108

119
func linspace(min, max float64, n uint) []float64 {
@@ -126,11 +124,6 @@ func linearInterpolate(a, b [4]float64, t float64) (i, j, k, l float64) {
126124
return
127125
}
128126

129-
func interpAngle(a, b, t float64) float64 {
130-
delta := math.Mod(((math.Mod(b-a, 360))+540), 360) - 180
131-
return math.Mod((a + t*delta + 360), 360)
132-
}
133-
134127
func blendRgb(a, b Color, t float64) Color {
135128
return Color{
136129
R: a.R + t*(b.R-a.R),
@@ -139,46 +132,3 @@ func blendRgb(a, b Color, t float64) Color {
139132
A: a.A + t*(b.A-a.A),
140133
}
141134
}
142-
143-
func blendLrgb(a, b colorful.Color, t float64) colorful.Color {
144-
r1, g1, b1 := a.LinearRgb()
145-
r2, g2, b2 := b.LinearRgb()
146-
return colorful.LinearRgb(
147-
r1+t*(r2-r1),
148-
g1+t*(g2-g1),
149-
b1+t*(b2-b1),
150-
)
151-
}
152-
153-
func blendOklab(ca, cb colorful.Color, t float64) colorful.Color {
154-
r1, g1, b1 := ca.LinearRgb()
155-
r2, g2, b2 := cb.LinearRgb()
156-
l1, a1, b1 := lrgbToOklab(r1, g1, b1)
157-
l2, a2, b2 := lrgbToOklab(r2, g2, b2)
158-
r, g, b := oklabToLrgb(
159-
l1+t*(l2-l1),
160-
a1+t*(a2-a1),
161-
b1+t*(b2-b1),
162-
)
163-
return colorful.LinearRgb(r, g, b)
164-
}
165-
166-
func lrgbToOklab(r, g, b float64) (L, A, B float64) {
167-
l := math.Cbrt(0.4121656120*r + 0.5362752080*g + 0.0514575653*b)
168-
m := math.Cbrt(0.2118591070*r + 0.6807189584*g + 0.1074065790*b)
169-
s := math.Cbrt(0.0883097947*r + 0.2818474174*g + 0.6302613616*b)
170-
L = 0.2104542553*l + 0.7936177850*m - 0.0040720468*s
171-
A = 1.9779984951*l - 2.4285922050*m + 0.4505937099*s
172-
B = 0.0259040371*l + 0.7827717662*m - 0.8086757660*s
173-
return
174-
}
175-
176-
func oklabToLrgb(l, a, b float64) (R, G, B float64) {
177-
l_ := math.Pow(l+0.3963377774*a+0.2158037573*b, 3)
178-
m_ := math.Pow(l-0.1055613458*a-0.0638541728*b, 3)
179-
s_ := math.Pow(l-0.0894841775*a-1.2914855480*b, 3)
180-
R = 4.0767245293*l_ - 3.3072168827*m_ + 0.2307590544*s_
181-
G = -1.2681437731*l_ + 2.6093323231*m_ - 0.3411344290*s_
182-
B = -0.0041119885*l_ - 0.7034763098*m_ + 1.7068625689*s_
183-
return
184-
}

0 commit comments

Comments
 (0)