Skip to content

Commit 318c582

Browse files
authored
style: add dark theme color scheme (#7118)
hen the user's browser does not support `light-dark`, fall back to the light theme color scheme.
1 parent db311e6 commit 318c582

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

src/browser/pages/error.css

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
.error-display > .body {
1313
color: #444;
14+
color: light-dark(#444, #ccc);
1415
font-size: 1.2rem;
1516
}
1617

src/browser/pages/error.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
http-equiv="Content-Security-Policy"
1111
content="style-src 'self'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;"
1212
/>
13-
13+
<meta name="color-scheme" content="light dark" />
1414
<title>{{ERROR_TITLE}} - code-server</title>
1515
<link rel="icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg" />
1616
<link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" />

src/browser/pages/global.css

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
:root {
2+
color-scheme: light dark;
3+
}
4+
15
html,
26
body,
37
#root {
@@ -7,7 +11,9 @@ body,
711

812
body {
913
background: rgb(244, 247, 252);
14+
background: light-dark(rgb(244, 247, 252), #111);
1015
color: #111;
16+
color: light-dark(#111, #ddd);
1117
margin: 0;
1218
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
1319
"Segoe UI Emoji", "Segoe UI Symbol";
@@ -23,10 +29,12 @@ button {
2329

2430
.-button {
2531
background-color: rgb(87, 114, 245);
32+
background-color: light-dark(rgb(87, 114, 245), rgb(50, 85, 250));
2633
border-radius: 5px;
2734
border: none;
2835
box-sizing: border-box;
2936
color: white;
37+
color: light-dark(white, #ddd);
3038
cursor: pointer;
3139
padding: 18px 20px;
3240
text-decoration: none;
@@ -45,6 +53,7 @@ button {
4553

4654
.card-box {
4755
background-color: rgb(250, 253, 258);
56+
background-color: light-dark(rgb(250, 253, 258), #000);
4857
border-radius: 5px;
4958
box-shadow:
5059
rgba(60, 66, 87, 0.117647) 0px 7px 14px 0px,
@@ -55,7 +64,9 @@ button {
5564

5665
.card-box > .header {
5766
border-bottom: 1px solid #ddd;
67+
border-bottom: 1px solid light-dark(#ddd, #222);
5868
color: #444;
69+
color: light-dark(#444, #ccc);
5970
padding: 30px;
6071
}
6172

@@ -66,6 +77,7 @@ button {
6677

6778
.card-box > .header > .sub {
6879
color: #555;
80+
color: light-dark(#555, #aaa);
6981
margin-top: 10px;
7082
}
7183

src/browser/pages/login.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ body {
3030

3131
.login-form > .field > .password {
3232
background-color: rgb(244, 247, 252);
33+
background-color: light-dark(rgb(244, 247, 252), #222);
3334
border-radius: 5px;
3435
border: 1px solid #ddd;
36+
border: 1px solid light-dark(#ddd, #333);
3537
box-sizing: border-box;
36-
color: black;
3738
flex: 1;
3839
padding: 16px;
3940
}

src/browser/pages/login.html

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
http-equiv="Content-Security-Policy"
1111
content="style-src 'self'; script-src 'self' 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:; font-src 'self' data:;"
1212
/>
13+
<meta name="color-scheme" content="light dark" />
1314
<title>{{I18N_LOGIN_TITLE}}</title>
1415
<link rel="icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon-dark-support.svg" />
1516
<link rel="alternate icon" href="{{CS_STATIC_BASE}}/src/browser/media/favicon.ico" />

0 commit comments

Comments
 (0)