From 0185be2ce45efdd988df2b2ee69b764f9e3c7f6c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 27 Oct 2022 13:07:07 +0200 Subject: [PATCH] Migrate line numbers CSS to CSS variables --- src/librustdoc/html/static/css/rustdoc.css | 8 ++++++++ src/librustdoc/html/static/css/themes/ayu.css | 12 +++--------- src/librustdoc/html/static/css/themes/dark.css | 14 +++----------- src/librustdoc/html/static/css/themes/light.css | 14 +++----------- 4 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b60c7719563..c20912dc69a 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -571,10 +571,18 @@ ul.block, .block li { padding: 13px 8px; border-top-left-radius: 5px; border-bottom-left-radius: 5px; + border-color: var(--example-line-numbers-border-color); } .src-line-numbers span { cursor: pointer; + color: var(--src-line-numbers-span-color); +} +.src-line-numbers .line-highlighted { + background-color: var(--src-line-number-highlighted-background-color); +} +.src-line-numbers :target { + background-color: transparent; } .search-loading { diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 33817c16808..fdfdb3e1966 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -55,6 +55,9 @@ Original by Dempfi (https://github.com/dempfi/ayu) --code-highlight-question-mark-color: #ff9011; --code-highlight-comment-color: #788797; --code-highlight-doc-comment-color: #a1ac88; + --example-line-numbers-border-color: none; + --src-line-numbers-span-color: #5c6773; + --src-line-number-highlighted-background-color: rgba(255, 236, 164, 0.06); } .slider { @@ -112,10 +115,8 @@ pre, .rustdoc.source .example-wrap { color: #ff7733; } -.src-line-numbers span { color: #5c6773; } .src-line-numbers .line-highlighted { color: #708090; - background-color: rgba(255, 236, 164, 0.06); padding-right: 4px; border-right: 1px solid #ffb44c; } @@ -170,13 +171,6 @@ details.rustdoc-toggle > summary::before { color: #788797; } -.src-line-numbers :target { background-color: transparent; } - -pre.example-line-numbers { - color: #5c67736e; - border: none; -} - a.test-arrow { font-size: 100%; color: #788797; diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index d88710288b9..361d3d4a225 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -50,6 +50,9 @@ --code-highlight-question-mark-color: #ff9011; --code-highlight-comment-color: #8d8d8b; --code-highlight-doc-comment-color: #8ca375; + --example-line-numbers-border-color: #4a4949; + --src-line-numbers-span-color: #3b91e2; + --src-line-number-highlighted-background-color: #0a042f; } .slider { @@ -69,11 +72,6 @@ input:focus + .slider { drop-shadow(0 -1px 0 #fff) } -.src-line-numbers span { color: #3B91E2; } -.src-line-numbers .line-highlighted { - background-color: #0a042f !important; -} - .content .item-info::before { color: #ccc; } body.source .example-wrap pre.rust a { @@ -95,12 +93,6 @@ details.rustdoc-toggle > summary::before { filter: invert(69%) sepia(60%) saturate(6613%) hue-rotate(184deg) brightness(100%) contrast(91%); } -.src-line-numbers :target { background-color: transparent; } - -pre.example-line-numbers { - border-color: #4a4949; -} - a.test-arrow { color: #dedede; background-color: rgba(78, 139, 202, 0.2); diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index cadc71dab95..5eb4bbcf834 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -50,6 +50,9 @@ --code-highlight-question-mark-color: #ff9011; --code-highlight-comment-color: #8e908c; --code-highlight-doc-comment-color: #4d4d4c; + --example-line-numbers-border-color: #c7c7c7; + --src-line-numbers-span-color: #c67e2d; + --src-line-number-highlighted-background-color: #fdffd3; } .slider { @@ -68,11 +71,6 @@ input:focus + .slider { */ } -.src-line-numbers span { color: #c67e2d; } -.src-line-numbers .line-highlighted { - background-color: #FDFFD3 !important; -} - .content .item-info::before { color: #ccc; } body.source .example-wrap pre.rust a { @@ -90,12 +88,6 @@ body.source .example-wrap pre.rust a { filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg) brightness(96%) contrast(93%); } -.src-line-numbers :target { background-color: transparent; } - -pre.example-line-numbers { - border-color: #c7c7c7; -} - a.test-arrow { color: #f5f5f5; background-color: rgba(78, 139, 202, 0.2);