diff options
| author | bors <bors@rust-lang.org> | 2018-01-25 06:12:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-01-25 06:12:06 +0000 |
| commit | 4cf26f8a133039bfeb5b9f684df9f547278db206 (patch) | |
| tree | cfa6b6847c31449d0a9409ac1abfedeea62e10d4 /src | |
| parent | 247835aacbf9ef743930b6412c7c7b09dc41aa0c (diff) | |
| parent | e78f1392b79779fa184f9a63e7be04ac7074a1c2 (diff) | |
| download | rust-4cf26f8a133039bfeb5b9f684df9f547278db206.tar.gz rust-4cf26f8a133039bfeb5b9f684df9f547278db206.zip | |
Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus
Few fixes for multiple themes support feature r? @QuietMisdreavus Fixes #47695.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/html/layout.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 8 | ||||
| -rw-r--r-- | src/librustdoc/html/static/rustdoc.css | 27 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/dark.css | 14 | ||||
| -rw-r--r-- | src/librustdoc/html/static/themes/main.css | 13 |
5 files changed, 47 insertions, 23 deletions
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index 8395b0686e1..fd14513cac4 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -74,10 +74,12 @@ r##"<!DOCTYPE html> {sidebar} </nav> - <button id="theme-picker"> - <img src="{root_path}brush.svg" width="18" alt="Pick another theme!"> + <div class="theme-picker"> + <button id="theme-picker" aria-label="Pick another theme!"> + <img src="{root_path}brush.svg" width="18" alt="Pick another theme!"> + </button> <div id="theme-choices"></div> - </button> + </div> <script src="{root_path}theme.js"></script> <nav class="sub"> <form class="search-form js-only"> diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index b0d535d9df6..b7862181119 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -918,12 +918,12 @@ themePicker.onclick = function() {{ }} }}; [{}].forEach(function(item) {{ - var div = document.createElement('div'); - div.innerHTML = item; - div.onclick = function(el) {{ + var but = document.createElement('button'); + but.innerHTML = item; + but.onclick = function(el) {{ switchTheme(currentTheme, mainTheme, item); }}; - themes.appendChild(div); + themes.appendChild(but); }}); "#, themes.iter() .map(|s| format!("\"{}\"", s)) diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index c1ca86e3292..d2eeb2e15b3 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -1141,13 +1141,19 @@ kbd { border: solid 1px; border-radius: 3px; box-shadow: inset 0 -1px 0; + cursor: default; } -#theme-picker { +.theme-picker { position: absolute; left: 211px; - top: 17px; + top: 19px; +} + +#theme-picker { padding: 4px; + width: 27px; + height: 29px; border: 1px solid; border-radius: 3px; cursor: pointer; @@ -1156,21 +1162,28 @@ kbd { #theme-choices { display: none; position: absolute; - left: -1px; - top: 30px; + left: 0; + top: 28px; border: 1px solid; border-radius: 3px; z-index: 1; + cursor: pointer; } -#theme-choices > div { - border-top: 1px solid; +#theme-choices > button { + border: none; + width: 100%; padding: 4px; text-align: center; + background: rgba(0,0,0,0); +} + +#theme-choices > button:not(:first-child) { + border-top: 1px solid; } @media (max-width: 700px) { - #theme-picker { + .theme-picker { left: 109px; top: 7px; z-index: 1; diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css index 05ac0660396..4c6bcab72b7 100644 --- a/src/librustdoc/html/static/themes/dark.css +++ b/src/librustdoc/html/static/themes/dark.css @@ -197,7 +197,7 @@ a.test-arrow { #help dt { border-color: #bfbfbf; - background: #fff; + background: rgba(0,0,0,0); color: black; } @@ -352,7 +352,7 @@ pre.ignore:hover, .information:hover + pre.ignore { } kbd { - color: #444d56; + color: #000; background-color: #fafbfc; border-color: #d1d5da; border-bottom-color: #c6cbd1; @@ -364,16 +364,20 @@ kbd { background: #f0f0f0; } +#theme-picker:hover, #theme-picker:focus { + border-color: #ffb900; +} + #theme-choices { border-color: #e0e0e0; background-color: #353535; } -#theme-choices > div { - border-top: #e0e0e0; +#theme-choices > button:not(:first-child) { + border-top-color: #e0e0e0; } -#theme-choices > div:hover { +#theme-choices > button:hover, #theme-choices > button:focus { background-color: #444; } diff --git a/src/librustdoc/html/static/themes/main.css b/src/librustdoc/html/static/themes/main.css index 84b21e7239f..9d650f92664 100644 --- a/src/librustdoc/html/static/themes/main.css +++ b/src/librustdoc/html/static/themes/main.css @@ -345,7 +345,7 @@ pre.ignore:hover, .information:hover + pre.ignore { } kbd { - color: #444d56; + color: #000; background-color: #fafbfc; border-color: #d1d5da; border-bottom-color: #c6cbd1; @@ -354,6 +354,11 @@ kbd { #theme-picker { border-color: #e0e0e0; + background-color: #fff; +} + +#theme-picker:hover, #theme-picker:focus { + border-color: #717171; } #theme-choices { @@ -361,11 +366,11 @@ kbd { background-color: #fff; } -#theme-choices > div { - border-top: #e0e0e0; +#theme-choices > button:not(:first-child) { + border-top-color: #e0e0e0; } -#theme-choices > div:hover { +#theme-choices > button:hover, #theme-choices > button:focus { background-color: #eee; } |
