2 Commits

Author SHA1 Message Date
9540d855e7 Update version to v3.1.0 (Fix custom gradient colors) 2026-02-01 21:20:46 +05:30
055f039b70 Add renovate.json 2026-01-03 20:28:36 +05:30
4 changed files with 27 additions and 4 deletions

View File

@@ -1,3 +1,9 @@
# v3.1.0
## What's Changed
* Updated logic to also replace gradient fills with custom colors when applicable
# v3.0.0
## Breaking Changes

View File

@@ -1 +1 @@
3.0.0
3.1.0

View File

@@ -169,16 +169,27 @@ func fetchRemoteFile(url string) (string, error) {
func applySVGColor(svgContent, colorCode string) string {
color := "#" + colorCode
// Replace fill:#fff
re1 := regexp.MustCompile(`style="[^"]*fill:\s*#fff[^"]*"`)
svgContent = re1.ReplaceAllStringFunc(svgContent, func(match string) string {
re2 := regexp.MustCompile(`fill:\s*#fff`)
return re2.ReplaceAllString(match, "fill:"+color)
})
re3 := regexp.MustCompile(`fill="#fff"`)
svgContent = re3.ReplaceAllString(svgContent, `fill="`+color+`"`)
// Replace stop-color:#fff in gradients
re4 := regexp.MustCompile(`style="[^"]*stop-color:\s*#fff[^"]*"`)
svgContent = re4.ReplaceAllStringFunc(svgContent, func(match string) string {
re5 := regexp.MustCompile(`stop-color:\s*#fff`)
return re5.ReplaceAllString(match, "stop-color:"+color)
})
re6 := regexp.MustCompile(`stop-color="#fff"`)
svgContent = re6.ReplaceAllString(svgContent, `stop-color="`+color+`"`)
return svgContent
}

6
renovate.json Normal file
View File

@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}