Skip to content

Commit 3a6f02b

Browse files
style: add dark theme 'theme-gitea-dark'
- Add `theme-gitea-dark` stylesheet and variables - Refactor color variables for dark mode compatibility - Update components: navbar, buttons, code blocks, issue list - Add basic accessibility contrast adjustments
1 parent 1f32170 commit 3a6f02b

File tree

14 files changed

+566
-245
lines changed

14 files changed

+566
-245
lines changed

web_src/css/base.css

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
:root {
22
/* fonts */
3-
--fonts-proportional: -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial;
4-
--fonts-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, var(--fonts-emoji);
3+
--fonts-proportional: -apple-system, "Segoe UI", system-ui, Roboto,
4+
"Helvetica Neue", Arial;
5+
--fonts-monospace: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco,
6+
Consolas, "Liberation Mono", "Courier New", monospace, var(--fonts-emoji);
57
/* GitHub explicitly sets font names like: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla";
68
Actually "Twemoji Mozilla" emoji font is widely used by browsers like Firefox, Pale Moon, and it is more likely up-to-dated than the system emoji font.
79
So not setting emoji font seems to be the best choice, here we just use a non-existing dummy font name and let browsers choose. */
@@ -54,18 +56,22 @@
5456
}
5557

5658
:root * {
57-
--fonts-regular: var(--fonts-override, var(--fonts-proportional)), "Noto Sans", "Liberation Sans", sans-serif, var(--fonts-emoji);
59+
--fonts-regular: var(--fonts-override, var(--fonts-proportional)), "Noto Sans",
60+
"Liberation Sans", sans-serif, var(--fonts-emoji);
5861
}
5962

60-
*, ::before, ::after {
63+
*,
64+
::before,
65+
::after {
6166
/* these are needed for tailwind borders to work because we do not load tailwind's base
6267
https://github.com/tailwindlabs/tailwindcss/blob/master/src/css/preflight.css */
6368
border-width: 0;
6469
border-style: solid;
6570
border-color: currentcolor;
6671
}
6772

68-
html, body {
73+
html,
74+
body {
6975
height: 100%;
7076
font-size: 14px;
7177
}
@@ -335,7 +341,7 @@ a.label,
335341

336342
.inline-code-block {
337343
padding: 2px 4px;
338-
border-radius: .24em;
344+
border-radius: 0.24em;
339345
background-color: var(--color-label-bg);
340346
}
341347

@@ -393,7 +399,7 @@ a.label,
393399
margin-bottom: -0.25rem;
394400
}
395401
.ui.dropdown .menu > .item > svg {
396-
margin-right: .78rem; /* use the same margin as for <img> */
402+
margin-right: 0.78rem; /* use the same margin as for <img> */
397403
}
398404

399405
.ui.selection.dropdown .menu > .item {
@@ -551,7 +557,7 @@ img.ui.avatar,
551557
}
552558

553559
.text.grey {
554-
color: var(--color-text-light) !important;
560+
color: var(--color-orange-badge) !important;
555561
}
556562

557563
.text.light {
@@ -692,35 +698,40 @@ img.ui.avatar,
692698
blockquote.attention-note {
693699
border-left-color: var(--color-blue-dark-1);
694700
}
695-
strong.attention-note, svg.attention-note {
701+
strong.attention-note,
702+
svg.attention-note {
696703
color: var(--color-blue-dark-1);
697704
}
698705

699706
blockquote.attention-tip {
700707
border-left-color: var(--color-success-text);
701708
}
702-
strong.attention-tip, svg.attention-tip {
709+
strong.attention-tip,
710+
svg.attention-tip {
703711
color: var(--color-success-text);
704712
}
705713

706714
blockquote.attention-important {
707715
border-left-color: var(--color-violet-dark-1);
708716
}
709-
strong.attention-important, svg.attention-important {
717+
strong.attention-important,
718+
svg.attention-important {
710719
color: var(--color-violet-dark-1);
711720
}
712721

713722
blockquote.attention-warning {
714723
border-left-color: var(--color-warning-text);
715724
}
716-
strong.attention-warning, svg.attention-warning {
725+
strong.attention-warning,
726+
svg.attention-warning {
717727
color: var(--color-warning-text);
718728
}
719729

720730
blockquote.attention-caution {
721731
border-left-color: var(--color-red-dark-1);
722732
}
723-
strong.attention-caution, svg.attention-caution {
733+
strong.attention-caution,
734+
svg.attention-caution {
724735
color: var(--color-red-dark-1);
725736
}
726737

@@ -985,7 +996,7 @@ table th[data-sortt-desc] .svg {
985996

986997
.ui.tabular.menu .item:hover,
987998
.ui.secondary.pointing.menu a.item:hover {
988-
color: var(--color-text);
999+
color: var(--color-primary-3);
9891000
}
9901001

9911002
.ui.tabular.menu .active.item,
@@ -1017,7 +1028,9 @@ table th[data-sortt-desc] .svg {
10171028
}
10181029

10191030
.ui.dropdown:not(.button) {
1020-
line-height: var(--line-height-default); /* the dropdown doesn't have default line-height, use this to make the dropdown icon align with plain dropdown */
1031+
line-height: var(
1032+
--line-height-default
1033+
); /* the dropdown doesn't have default line-height, use this to make the dropdown icon align with plain dropdown */
10211034
}
10221035

10231036
/* dropdown has some kinds of icons:

0 commit comments

Comments
 (0)