Skip to content

Commit 56c8f98

Browse files
jpkhawamearl-warren
authored andcommitted
[THEME] Add colorblind theme variants
This PR adds colorblind theme variants of the forgejo themes. I duplicated the forjego light and dark themes and only changed the lines related to diff colors for added and removed rows/words. I am not a designer, and I am also colorblind, so better suggestions of colors are most welcome. However, this is a good start as I can at least personally see the colors now. I got the colors for the dark theme from the GitHub diff colors, the light ones I couldn't get from GitHub as they use white as a plain background, which Forgejo's theme doesn't, so they were decided on after a bit of random testing. Resolves go-gitea#986 (cherry picked from commit dcdb4a372da814eda27065c58d03100f0589f0a7)
1 parent 88171e0 commit 56c8f98

8 files changed

+50
-2
lines changed

modules/setting/ui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ var UI = struct {
8282
ReactionMaxUserNum: 10,
8383
MaxDisplayFileSize: 8388608,
8484
DefaultTheme: `forgejo-auto`,
85-
Themes: []string{`forgejo-auto`, `forgejo-light`, `forgejo-dark`, `gitea-auto`, `gitea-light`, `gitea-dark`},
85+
Themes: []string{`forgejo-auto`, `forgejo-light`, `forgejo-dark`, `gitea-auto`, `gitea-light`, `gitea-dark`, `forgejo-auto-deuteranopia-protanopia`, `forgejo-light-deuteranopia-protanopia`, `forgejo-dark-deuteranopia-protanopia`, `forgejo-auto-tritanopia`, `forgejo-light-tritanopia`, `forgejo-dark-tritanopia`},
8686
Reactions: []string{`+1`, `-1`, `laugh`, `hooray`, `confused`, `heart`, `rocket`, `eyes`},
8787
CustomEmojis: []string{`git`, `gitea`, `codeberg`, `gitlab`, `github`, `gogs`, `forgejo`},
8888
CustomEmojisMap: map[string]string{"git": ":git:", "gitea": ":gitea:", "codeberg": ":codeberg:", "gitlab": ":gitlab:", "github": ":github:", "gogs": ":gogs:", "forgejo": ":forgejo:"},

services/forms/user_form.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func (f *AddEmailForm) Validate(req *http.Request, errs binding.Errors) binding.
277277

278278
// UpdateThemeForm form for updating a users' theme
279279
type UpdateThemeForm struct {
280-
Theme string `binding:"Required;MaxSize(30)"`
280+
Theme string `binding:"Required;MaxSize(64)"`
281281
}
282282

283283
// Validate validates the field
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import "theme-forgejo-light-deuteranopia-protanopia.css";
2+
@import "theme-forgejo-dark-deuteranopia-protanopia.css" (prefers-color-scheme: dark);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import "theme-forgejo-light-tritanopia.css";
2+
@import "theme-forgejo-dark-tritanopia.css" (prefers-color-scheme: dark);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "./theme-forgejo-dark.css";
2+
3+
:root {
4+
--color-diff-removed-word-bg: #693F17;
5+
--color-diff-removed-row-border: #693F17;
6+
--color-diff-removed-row-bg: #221B17;
7+
--color-diff-added-word-bg: #214D88;
8+
--color-diff-added-row-border: #214D88;
9+
--color-diff-added-row-bg: #13233A;
10+
--color-code-bg: #0D1117;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "./theme-forgejo-dark.css";
2+
3+
:root {
4+
--color-diff-removed-word-bg: #792E2E;
5+
--color-diff-removed-row-border: #792E2E;
6+
--color-diff-removed-row-bg: #25171C;
7+
--color-diff-added-word-bg: #214D88;
8+
--color-diff-added-row-border: #214D88;
9+
--color-diff-added-row-bg: #13233A;
10+
--color-code-bg: #0D1117;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "./theme-forgejo-light.css";
2+
3+
:root {
4+
--color-diff-removed-word-bg: #FFDBB0;
5+
--color-diff-removed-row-border: #FFDBB0;
6+
--color-diff-removed-row-bg: #FFFAF3;
7+
--color-diff-added-word-bg: #B1DBFF;
8+
--color-diff-added-row-border: #B1DBFF;
9+
--color-diff-added-row-bg: #EEF9FF;
10+
--color-code-bg: #FFFFFF;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import "./theme-forgejo-light.css";
2+
3+
:root {
4+
--color-diff-removed-word-bg: #FFD0CE;
5+
--color-diff-removed-row-border: #FFD0CE;
6+
--color-diff-removed-row-bg: #FFF5F4;
7+
--color-diff-added-word-bg: #B1DBFF;
8+
--color-diff-added-row-border: #EEF9FF;
9+
--color-diff-added-row-bg: #EEF9FF;
10+
--color-code-bg: #FFFFFF;
11+
}

0 commit comments

Comments
 (0)