From 98f05a0282625a5fda6e90ebf3b05a4bd7608f65 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 24 Sep 2022 15:49:10 +0200 Subject: [PATCH] * Migrate sidebar links color to new CSS theme handling * Remove specific color handling for ".current" items in the sidebar. --- src/librustdoc/html/static/css/rustdoc.css | 8 +++++++ src/librustdoc/html/static/css/themes/ayu.css | 21 ++-------------- .../html/static/css/themes/dark.css | 24 ++----------------- .../html/static/css/themes/light.css | 24 ++----------------- 4 files changed, 14 insertions(+), 63 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index e92e9137d6402..a2465f0517660 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -547,6 +547,14 @@ h2.location a { margin: 0; } +.sidebar a, .sidebar .current { + color: var(--sidebar-link-color); +} +.sidebar .current, +.sidebar a:hover { + background-color: var(--sidebar-current-link-background-color); +} + .sidebar-elems .block { margin-bottom: 2em; } diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 44238ca573dcd..1c317aa7cfe6c 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -35,6 +35,8 @@ Original by Dempfi (https://github.com/dempfi/ayu) --keyword-link-color: #39afd7; --mod-link-color: #39afd7; --link-color: #39afd7; + --sidebar-link-color: #53b1db; + --sidebar-current-link-background-color: transparent; } .slider { @@ -85,7 +87,6 @@ pre, .rustdoc.source .example-wrap { .sidebar .current, .sidebar a:hover { - background-color: transparent; color: #ffb44c; } @@ -119,9 +120,6 @@ pre, .rustdoc.source .example-wrap { .content .item-info::before { color: #ccc; } -.sidebar a { color: #53b1db; } -.sidebar a.current.type { color: #53b1db; } - pre.rust .comment { color: #788797; } pre.rust .doccomment { color: #a1ac88; } @@ -284,21 +282,6 @@ a.result-static:focus {} a.result-primitive:focus {} a.result-keyword:focus {} -.sidebar a.current.enum {} -.sidebar a.current.struct {} -.sidebar a.current.foreigntype {} -.sidebar a.current.attr, -.sidebar a.current.derive, -.sidebar a.current.macro {} -.sidebar a.current.union {} -.sidebar a.current.constant -.sidebar a.current.static {} -.sidebar a.current.primitive {} -.sidebar a.current.trait {} -.sidebar a.current.traitalias {} -.sidebar a.current.fn {} -.sidebar a.current.keyword {} - kbd { color: #c5c5c5; background-color: #314559; diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index 858d836c03d5e..a8204eebe547b 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -30,6 +30,8 @@ --keyword-link-color: #d2991d; --mod-link-color: #d2991d; --link-color: #d2991d; + --sidebar-link-color: #fdbf35; + --sidebar-current-link-background-color: #444; } .slider { @@ -49,11 +51,6 @@ input:focus + .slider { drop-shadow(0 -1px 0 #fff) } -.sidebar .current, -.sidebar a:hover { - background: #444; -} - .src-line-numbers span { color: #3B91E2; } .src-line-numbers .line-highlighted { background-color: #0a042f !important; @@ -91,23 +88,6 @@ a.result-keyword:focus { background-color: #884719; } .content .item-info::before { color: #ccc; } -.sidebar a { color: #fdbf35; } -.sidebar a.current.enum { color: #12ece2; } -.sidebar a.current.struct { color: #12ece2; } -.sidebar a.current.type { color: #12ece2; } -.sidebar a.current.foreigntype { color: #12ece2; } -.sidebar a.current.attr, -.sidebar a.current.derive, -.sidebar a.current.macro { color: #0be900; } -.sidebar a.current.union { color: #12ece2; } -.sidebar a.current.constant -.sidebar a.current.static { color: #fdbf35; } -.sidebar a.current.primitive { color: #12ece2; } -.sidebar a.current.trait { color: #cca7ff; } -.sidebar a.current.traitalias { color: #cca7ff; } -.sidebar a.current.fn { color: #32d479; } -.sidebar a.current.keyword { color: #fdbf35; } - pre.rust .comment { color: #8d8d8b; } pre.rust .doccomment { color: #8ca375; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 6fbea6f6c7a5d..8fb60b6f887f5 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -30,6 +30,8 @@ --keyword-link-color: #3873ad; --mod-link-color: #3873ad; --link-color: #3873ad; + --sidebar-link-color: #356da4; + --sidebar-current-link-background-color: #fff; } .slider { @@ -48,11 +50,6 @@ input:focus + .slider { */ } -.sidebar .current, -.sidebar a:hover { - background-color: #fff; -} - .src-line-numbers span { color: #c67e2d; } .src-line-numbers .line-highlighted { background-color: #FDFFD3 !important; @@ -90,23 +87,6 @@ a.result-keyword:focus { background-color: #afc6e4; } .content .item-info::before { color: #ccc; } -.sidebar a { color: #356da4; } -.sidebar a.current.enum { color: #a63283; } -.sidebar a.current.struct { color: #a63283; } -.sidebar a.current.type { color: #a63283; } -.sidebar a.current.foreigntype { color: #356da4; } -.sidebar a.current.attr, -.sidebar a.current.derive, -.sidebar a.current.macro { color: #067901; } -.sidebar a.current.union { color: #a63283; } -.sidebar a.current.constant -.sidebar a.current.static { color: #356da4; } -.sidebar a.current.primitive { color: #a63283; } -.sidebar a.current.trait { color: #6849c3; } -.sidebar a.current.traitalias { color: #4b349e; } -.sidebar a.current.fn { color: #a67736; } -.sidebar a.current.keyword { color: #356da4; } - body.source .example-wrap pre.rust a { background: #eee; }