Skip to content

Commit

Permalink
Migrate tooltip style to CSS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Nov 17, 2022
1 parent 7c75fe4 commit 16b5590
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 31 deletions.
6 changes: 4 additions & 2 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,8 @@ pre.rust .doccomment {
width: max-content;
top: -2px;
z-index: 1;
background-color: var(--tooltip-background-color);
color: var(--tooltip-color);
}

.example-wrap .tooltip::before {
Expand All @@ -1170,10 +1172,10 @@ pre.rust .doccomment {
top: 50%;
left: 16px;
margin-top: -5px;
border-width: 5px;
border-style: solid;
display: none;
z-index: 1;
border: 5px solid transparent;
border-right-color: var(--tooltip-background-color);
}

.example-wrap.ignore .tooltip::after {
Expand Down
11 changes: 2 additions & 9 deletions src/librustdoc/html/static/css/themes/ayu.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Original by Dempfi (https://github.com/dempfi/ayu)
--test-arrow-hover-background-color: rgba(57, 175, 215, 0.368);
--target-background-color: rgba(255, 236, 164, 0.06);
--target-border-color: rgba(255, 180, 76, 0.85);
--tooltip-background-color: #314559;
--tooltip-color: #c5c5c5;
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
drop-shadow(-1px 0 0 #fff)
Expand Down Expand Up @@ -160,15 +162,6 @@ details.rustdoc-toggle > summary::before {
color: #788797;
}

.tooltip::after {
background-color: #314559;
color: #c5c5c5;
}

.tooltip::before {
border-color: transparent #314559 transparent transparent;
}

#titles > button.selected {
background-color: #141920 !important;
border-bottom: 1px solid #ffb44c !important;
Expand Down
12 changes: 2 additions & 10 deletions src/librustdoc/html/static/css/themes/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
--test-arrow-hover-background-color: #4e8bca;
--target-background-color: #494a3d;
--target-border-color: #bb7410;
--tooltip-background-color: #000;
--tooltip-color: #fff;
--rust-logo-filter: drop-shadow(1px 0 0px #fff)
drop-shadow(0 1px 0 #fff)
drop-shadow(-1px 0 0 #fff)
Expand All @@ -82,16 +84,6 @@ details.rustdoc-toggle > summary::before {
filter: invert(100%);
}

.tooltip::after {
background-color: #000;
color: #fff;
border-color: #000;
}

.tooltip::before {
border-color: transparent black transparent transparent;
}

#titles > button:not(.selected) {
background-color: #252525;
border-top-color: #252525;
Expand Down
13 changes: 3 additions & 10 deletions src/librustdoc/html/static/css/themes/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@
--test-arrow-background-color: rgba(78, 139, 202, 0.2);
--test-arrow-hover-color: #f5f5f5;
--test-arrow-hover-background-color: #4e8bca;
--target-background-color: #fdFfd3;
--target-background-color: #fdffd3;
--target-border-color: #ad7c37;
--tooltip-background-color: #fdffd3;
--tooltip-color: #fff;
--rust-logo-filter: initial;
/* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
--crate-search-div-filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg)
Expand All @@ -75,15 +77,6 @@ body.source .example-wrap pre.rust a {
background: #eee;
}

.tooltip::after {
background-color: #000;
color: #fff;
}

.tooltip::before {
border-color: transparent black transparent transparent;
}

#titles > button:not(.selected) {
background-color: #e6e6e6;
border-top-color: #e6e6e6;
Expand Down

0 comments on commit 16b5590

Please sign in to comment.