summaryrefslogtreecommitdiff
path: root/styles.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-07-20 23:04:50 +0800
committerxuri <xuri.me@gmail.com>2021-07-20 23:04:50 +0800
commit1ec0207fb5fe772e47b257ab2b0c26ff85f94598 (patch)
tree75d342d8ebef7619cd29e88d0c5d5fe2b45760db /styles.go
parentec0ca8ba50a3a59048c51e360301230f45dfc978 (diff)
Fix code security issue
Diffstat (limited to 'styles.go')
-rw-r--r--styles.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/styles.go b/styles.go
index 5b9b200..07ccab1 100644
--- a/styles.go
+++ b/styles.go
@@ -3130,11 +3130,11 @@ func ThemeColor(baseColor string, tint float64) string {
if tint == 0 {
return "FF" + baseColor
}
- r, _ := strconv.ParseInt(baseColor[0:2], 16, 64)
- g, _ := strconv.ParseInt(baseColor[2:4], 16, 64)
- b, _ := strconv.ParseInt(baseColor[4:6], 16, 64)
+ r, _ := strconv.ParseUint(baseColor[0:2], 16, 64)
+ g, _ := strconv.ParseUint(baseColor[2:4], 16, 64)
+ b, _ := strconv.ParseUint(baseColor[4:6], 16, 64)
var h, s, l float64
- if r >= 0 && r <= math.MaxUint8 && g >= 0 && g <= math.MaxUint8 && b >= 0 && b <= math.MaxUint8 {
+ if r <= math.MaxUint8 && g <= math.MaxUint8 && b <= math.MaxUint8 {
h, s, l = RGBToHSL(uint8(r), uint8(g), uint8(b))
}
if tint < 0 {