Skip to content

Commit 1c65997

Browse files
Create new CSS variables for links color
1 parent 28956d1 commit 1c65997

File tree

4 files changed

+67
-78
lines changed

4 files changed

+67
-78
lines changed

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

+43
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,49 @@ pre.rust a,
242242
color: var(--main-color);
243243
}
244244

245+
.content span.enum, .content a.enum,
246+
.content span.struct, .content a.struct,
247+
.content span.union, .content a.union,
248+
.content span.primitive, .content a.primitive,
249+
.content span.type, .content a.type,
250+
.content span.foreigntype, .content a.foreigntype {
251+
color: var(--type-link-color);
252+
}
253+
254+
.content span.trait, .content a.trait,
255+
.content span.traitalias, .content a.traitalias {
256+
color: var(--trait-link-color);
257+
}
258+
259+
.content span.associatedtype, .content a.associatedtype,
260+
.content span.constant, .content a.constant,
261+
.content span.static, .content a.static {
262+
color: var(--assoc-item-link-color);
263+
}
264+
265+
.content span.fn, .content a.fn,
266+
.content .fnname {
267+
color: var(--function-link-color);
268+
}
269+
270+
.content span.attr, .content a.attr,
271+
.content span.derive, .content a.derive,
272+
.content span.macro, .content a.macro {
273+
color: var(--macro-link-color);
274+
}
275+
276+
.content span.mod, .content a.mod, .block a.current.mod {
277+
color: var(--mod-link-color);
278+
}
279+
280+
.content span.keyword, .content a.keyword {
281+
color: var(--keyword-link-color);
282+
}
283+
284+
a {
285+
color: var(--link-color);
286+
}
287+
245288
ol, ul {
246289
padding-left: 24px;
247290
}

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

+8-32
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ Original by Dempfi (https://github.com/dempfi/ayu)
2727
--codeblock-error-color: rgba(255, 0, 0, .5);
2828
--codeblock-ignore-hover-color: rgb(255, 142, 0);
2929
--codeblock-ignore-color: rgba(255, 142, 0, .6);
30+
--type-link-color: #ffa0a5;
31+
--trait-link-color: #39afd7;
32+
--assoc-item-link-color: #39afd7;
33+
--function-link-color: #fdd687;
34+
--macro-link-color: #a37acc;
35+
--keyword-link-color: #39afd7;
36+
--mod-link-color: #39afd7;
37+
--link-color: #39afd7;
3038
}
3139

3240
.slider {
@@ -111,44 +119,12 @@ pre, .rustdoc.source .example-wrap {
111119

112120
.content .item-info::before { color: #ccc; }
113121

114-
.content span.foreigntype, .content a.foreigntype { color: #ffa0a5; }
115-
.content span.union, .content a.union { color: #ffa0a5; }
116-
.content span.constant, .content a.constant,
117-
.content span.static, .content a.static { color: #39AFD7; }
118-
.content span.primitive, .content a.primitive { color: #ffa0a5; }
119-
.content span.traitalias, .content a.traitalias { color: #39AFD7; }
120-
.content span.keyword, .content a.keyword { color: #39AFD7; }
121-
.content span.mod, .content a.mod {
122-
color: #39AFD7;
123-
}
124-
.content span.struct, .content a.struct {
125-
color: #ffa0a5;
126-
}
127-
.content span.enum, .content a.enum {
128-
color: #ffa0a5;
129-
}
130-
.content span.trait, .content a.trait {
131-
color: #39AFD7;
132-
}
133-
.content span.type, .content a.type { color: #39AFD7; }
134-
.content span.associatedtype, .content a.associatedtype { color: #39AFD7; }
135-
.content span.fn, .content a.fn,
136-
.content .fnname { color: #fdd687; }
137-
.content span.attr, .content a.attr, .content span.derive,
138-
.content a.derive, .content span.macro, .content a.macro {
139-
color: #a37acc;
140-
}
141-
142122
.sidebar a { color: #53b1db; }
143123
.sidebar a.current.type { color: #53b1db; }
144124

145125
pre.rust .comment { color: #788797; }
146126
pre.rust .doccomment { color: #a1ac88; }
147127

148-
a {
149-
color: #39AFD7;
150-
}
151-
152128
.sidebar h2 a,
153129
.sidebar h3 a {
154130
color: white;

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

+8-23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
--codeblock-error-color: rgba(255, 0, 0, .5);
2323
--codeblock-ignore-hover-color: rgb(255, 142, 0);
2424
--codeblock-ignore-color: rgba(255, 142, 0, .6);
25+
--type-link-color: #2dbfb8;
26+
--trait-link-color: #b78cf2;
27+
--assoc-item-link-color: #d2991d;
28+
--function-link-color: #2bab63;
29+
--macro-link-color: #09bd00;
30+
--keyword-link-color: #d2991d;
31+
--mod-link-color: #d2991d;
32+
--link-color: #d2991d;
2533
}
2634

2735
.slider {
@@ -83,25 +91,6 @@ a.result-keyword:focus { background-color: #884719; }
8391

8492
.content .item-info::before { color: #ccc; }
8593

86-
.content span.enum, .content a.enum { color: #2dbfb8; }
87-
.content span.struct, .content a.struct { color: #2dbfb8; }
88-
.content span.type, .content a.type { color: #2dbfb8; }
89-
.content span.associatedtype, .content a.associatedtype { color: #D2991D; }
90-
.content span.foreigntype, .content a.foreigntype { color: #2dbfb8; }
91-
.content span.attr, .content a.attr,
92-
.content span.derive, .content a.derive,
93-
.content span.macro, .content a.macro { color: #09bd00; }
94-
.content span.union, .content a.union { color: #2dbfb8; }
95-
.content span.constant, .content a.constant,
96-
.content span.static, .content a.static { color: #D2991D; }
97-
.content span.primitive, .content a.primitive { color: #2dbfb8; }
98-
.content span.mod, .content a.mod { color: #D2991D; }
99-
.content span.trait, .content a.trait { color: #b78cf2; }
100-
.content span.traitalias, .content a.traitalias { color: #b78cf2; }
101-
.content span.fn, .content a.fn,
102-
.content .fnname { color: #2BAB63; }
103-
.content span.keyword, .content a.keyword { color: #D2991D; }
104-
10594
.sidebar a { color: #fdbf35; }
10695
.sidebar a.current.enum { color: #12ece2; }
10796
.sidebar a.current.struct { color: #12ece2; }
@@ -122,10 +111,6 @@ a.result-keyword:focus { background-color: #884719; }
122111
pre.rust .comment { color: #8d8d8b; }
123112
pre.rust .doccomment { color: #8ca375; }
124113

125-
a {
126-
color: #D2991D;
127-
}
128-
129114
body.source .example-wrap pre.rust a {
130115
background: #333;
131116
}

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

+8-23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
--codeblock-error-color: rgba(255, 0, 0, .5);
2323
--codeblock-ignore-hover-color: rgb(255, 142, 0);
2424
--codeblock-ignore-color: rgba(255, 142, 0, .6);
25+
--type-link-color: #ad378a;
26+
--trait-link-color: #6e4fc9;
27+
--assoc-item-link-color: #3873ad;
28+
--function-link-color: #ad7c37;
29+
--macro-link-color: #068000;
30+
--keyword-link-color: #3873ad;
31+
--mod-link-color: #3873ad;
32+
--link-color: #3873ad;
2533
}
2634

2735
.slider {
@@ -82,25 +90,6 @@ a.result-keyword:focus { background-color: #afc6e4; }
8290

8391
.content .item-info::before { color: #ccc; }
8492

85-
.content span.enum, .content a.enum { color: #AD378A; }
86-
.content span.struct, .content a.struct { color: #AD378A; }
87-
.content span.type, .content a.type { color: #AD378A; }
88-
.content span.associatedtype, .content a.associatedtype { color: #3873AD; }
89-
.content span.foreigntype, .content a.foreigntype { color: #3873AD; }
90-
.content span.attr, .content a.attr,
91-
.content span.derive, .content a.derive,
92-
.content span.macro, .content a.macro { color: #068000; }
93-
.content span.union, .content a.union { color: #AD378A; }
94-
.content span.constant, .content a.constant,
95-
.content span.static, .content a.static { color: #3873AD; }
96-
.content span.primitive, .content a.primitive { color: #AD378A; }
97-
.content span.mod, .content a.mod { color: #3873AD; }
98-
.content span.trait, .content a.trait { color: #6E4FC9; }
99-
.content span.traitalias, .content a.traitalias { color: #5137AD; }
100-
.content span.fn, .content a.fn,
101-
.content .fnname { color: #AD7C37; }
102-
.content span.keyword, .content a.keyword { color: #3873AD; }
103-
10493
.sidebar a { color: #356da4; }
10594
.sidebar a.current.enum { color: #a63283; }
10695
.sidebar a.current.struct { color: #a63283; }
@@ -118,10 +107,6 @@ a.result-keyword:focus { background-color: #afc6e4; }
118107
.sidebar a.current.fn { color: #a67736; }
119108
.sidebar a.current.keyword { color: #356da4; }
120109

121-
a {
122-
color: #3873AD;
123-
}
124-
125110
body.source .example-wrap pre.rust a {
126111
background: #eee;
127112
}

0 commit comments

Comments
 (0)