Skip to content

Commit 2aa7f54

Browse files
authored
Rollup merge of #104640 - GuillaumeGomez:migrate-kdb-css, r=notriddle
Migrate kdb style to CSS variables r? `@notriddle`
2 parents c5f92ce + b01502a commit 2aa7f54

File tree

5 files changed

+50
-18
lines changed

5 files changed

+50
-18
lines changed

src/librustdoc/html/static/css/rustdoc.css

+3
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,9 @@ kbd {
14311431
border: solid 1px var(--border-color);
14321432
border-radius: 3px;
14331433
cursor: default;
1434+
color: var(--kbd--color);
1435+
background-color: var(--kbd-background);
1436+
box-shadow: inset 0 -1px 0 var(--kbd-box-shadow-color);
14341437
}
14351438

14361439
ul.all-items > li {

src/librustdoc/html/static/css/themes/ayu.css

+3-6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ Original by Dempfi (https://github.com/dempfi/ayu)
6969
--target-border-color: rgba(255, 180, 76, 0.85);
7070
--tooltip-background-color: #314559;
7171
--tooltip-color: #c5c5c5;
72+
--kbd-color: #c5c5c5;
73+
--kbd-background: #314559;
74+
--kbd-box-shadow-color: #5c6773;
7275
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
7376
drop-shadow(0 1px 0 #fff)
7477
drop-shadow(-1px 0 0 #fff)
@@ -195,12 +198,6 @@ pre.rust .kw {}
195198
pre.rust .self, pre.rust .bool-val, pre.rust .prelude-val, pre.rust .attribute {}
196199
pre.rust .kw-2, pre.rust .prelude-ty {}
197200

198-
kbd {
199-
color: #c5c5c5;
200-
background-color: #314559;
201-
box-shadow: inset 0 -1px 0 #5c6773;
202-
}
203-
204201
#settings-menu > a img {
205202
filter: invert(100);
206203
}

src/librustdoc/html/static/css/themes/dark.css

+3-6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
--target-border-color: #bb7410;
6565
--tooltip-background-color: #000;
6666
--tooltip-color: #fff;
67+
--kbd-color: #000;
68+
--kbd-background: #fafbfc;
69+
--kbd-box-shadow-color: #c6cbd1;
6770
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
6871
drop-shadow(0 1px 0 #fff)
6972
drop-shadow(-1px 0 0 #fff)
@@ -100,12 +103,6 @@ details.rustdoc-toggle > summary::before {
100103
color: #888;
101104
}
102105

103-
kbd {
104-
color: #000;
105-
background-color: #fafbfc;
106-
box-shadow: inset 0 -1px 0 #c6cbd1;
107-
}
108-
109106
.search-results .result-name span.alias {
110107
color: #fff;
111108
}

src/librustdoc/html/static/css/themes/light.css

+3-6
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464
--target-border-color: #ad7c37;
6565
--tooltip-background-color: #fdffd3;
6666
--tooltip-color: #fff;
67+
--kbd-color: #000;
68+
--kbd-background: #fafbfc;
69+
--kbd-box-shadow-color: #c6cbd1;
6770
--rust-logo-filter: initial;
6871
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
6972
--crate-search-div-filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg)
@@ -93,12 +96,6 @@ body.source .example-wrap pre.rust a {
9396
color: #888;
9497
}
9598

96-
kbd {
97-
color: #000;
98-
background-color: #fafbfc;
99-
box-shadow: inset 0 -1px 0 #c6cbd1;
100-
}
101-
10299
.search-results .result-name span.alias {
103100
color: #000;
104101
}

src/test/rustdoc-gui/help-page.goml

+38
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,44 @@ assert-css: ("#help", {"display": "block"})
1313
compare-elements-property: (".sub", "#help", ["offsetWidth"])
1414
compare-elements-position: (".sub", "#help", ("x"))
1515

16+
// Checking the color of the elements of the help menu.
17+
show-text: true
18+
define-function: (
19+
"check-colors",
20+
(theme, color, background, box_shadow),
21+
[
22+
// Setting the theme.
23+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
24+
// We reload the page so the local storage settings are being used.
25+
("reload"),
26+
("assert-css", ("#help kbd", {
27+
"color": |color|,
28+
"background-color": |background|,
29+
"box-shadow": |box_shadow| + " 0px -1px 0px 0px inset",
30+
"cursor": "default",
31+
}, ALL)),
32+
],
33+
)
34+
35+
call-function: ("check-colors", {
36+
"theme": "ayu",
37+
"color": "rgb(197, 197, 197)",
38+
"background": "rgb(49, 69, 89)",
39+
"box_shadow": "rgb(92, 103, 115)",
40+
})
41+
call-function: ("check-colors", {
42+
"theme": "dark",
43+
"color": "rgb(221, 221, 221)",
44+
"background": "rgb(250, 251, 252)",
45+
"box_shadow": "rgb(198, 203, 209)",
46+
})
47+
call-function: ("check-colors", {
48+
"theme": "light",
49+
"color": "rgb(0, 0, 0)",
50+
"background": "rgb(250, 251, 252)",
51+
"box_shadow": "rgb(198, 203, 209)",
52+
})
53+
1654
// This test ensures that opening the help popover without switching pages works.
1755
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
1856
size: (1000, 1000) // Only supported on desktop.

0 commit comments

Comments
 (0)