Skip to content

Commit

Permalink
feat: auto theme available (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
LelouchFR authored Jun 2, 2024
1 parent 9075d57 commit 76e2ed6
Show file tree
Hide file tree
Showing 237 changed files with 7,638 additions and 318 deletions.
2 changes: 1 addition & 1 deletion .github/security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [[ $1 -eq 0 ]]; then
exit 1
fi
else
has_js_tag=$(grep -l "script" ./assets/*.svg)
has_js_tag=$(grep -l "<script" ./assets/*.svg)

if [[ -z "$has_js_tag" ]]; then
echo "no xss attack found"
Expand Down
250 changes: 125 additions & 125 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions api/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func iconRoute(r *gin.RouterGroup) {

theme := ctx.Request.Form.Get("theme")
if theme == "" {
theme = "dark"
theme = "auto"
}

perLineStr := ctx.Request.Form.Get("perline")
Expand All @@ -197,8 +197,8 @@ func iconRoute(r *gin.RouterGroup) {
return
}

if theme != "dark" && theme != "light" && theme != "" {
ctx.String(http.StatusBadRequest, "Theme must be either 'light' or 'dark'")
if theme != "dark" && theme != "light" && theme != "auto" && theme != "" {
ctx.String(http.StatusBadRequest, "Theme must be either 'light', 'dark' or 'auto'")
return
}

Expand Down Expand Up @@ -244,7 +244,7 @@ func Handler(w http.ResponseWriter, r *http.Request) {
// Populate iconNameList and themedIcons
for key := range icons {
iconNameList = append(iconNameList, strings.Split(key, "-")[0])
if strings.Contains(key, "-light") || strings.Contains(key, "-dark") {
if strings.Contains(key, "-light") || strings.Contains(key, "-dark") || strings.Contains(key, "-auto") {
themedIcons = append(themedIcons, strings.Split(key, "-")[0])
}
}
Expand Down
15 changes: 15 additions & 0 deletions assets/ableton-auto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions assets/activitypub-auto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/activitypub-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions assets/actix-auto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions assets/aiscript-auto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/alpinejs-auto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 76e2ed6

Please sign in to comment.