From 5ee3d5a3422f1594076b855c4395fb8538dabcfd Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Wed, 22 May 2024 07:12:26 -0400 Subject: [PATCH] Override RTD CSS. --- doc/book.toml | 2 +- doc/rtd-mdbook.css | 24 ++++++ doc/rtd.css | 187 -------------------------------------------- doc/theme/index.hbs | 2 +- 4 files changed, 26 insertions(+), 189 deletions(-) create mode 100644 doc/rtd-mdbook.css delete mode 100644 doc/rtd.css diff --git a/doc/book.toml b/doc/book.toml index fc142c0..b7cc1f7 100644 --- a/doc/book.toml +++ b/doc/book.toml @@ -15,4 +15,4 @@ create-missing = false # [output.html] must be the last table so that .readthedocs.yaml can easily add a key to it [output.html] git-repository-url = "https://github.com/glotzerlab/software" -additional-css = ["rtd.css"] +additional-css = ["rtd-mdbook.css"] diff --git a/doc/rtd-mdbook.css b/doc/rtd-mdbook.css new file mode 100644 index 0000000..5c38546 --- /dev/null +++ b/doc/rtd-mdbook.css @@ -0,0 +1,24 @@ +/* Use mdbook theme colors. */ + +#mdbook-ad-placement .ethical-sidebar { + border: none; + box-shadow: none; + background-color: var(--sidebar-bg); +} + +#mdbook-ad-placement .ethical-sidebar:hover { + background-color: var(--theme-hover); +} + +#mdbook-ad-placement .ethical-sidebar a { + color: var(--sidebar-non-existant); +} + +#sidebar #mdbook-ad-placement .ethical-sidebar .ethical-callout { + color: var(--sidebar-non-existant); +} + +/* Multiple id selectors and !important are needed to override the !important in the injected CSS */ +#sidebar #mdbook-ad-placement .ethical-sidebar .ethical-callout a { + color: var(--sidebar-non-existant) !important; +} diff --git a/doc/rtd.css b/doc/rtd.css deleted file mode 100644 index 467c4d5..0000000 --- a/doc/rtd.css +++ /dev/null @@ -1,187 +0,0 @@ -/* Read the Docs promotional block, only applicable to RTD.org - -To support sphinx_rtd_theme, a `wy-menu` element is added. Other themes are -targeted using the theme identifier and use custom elements instead of a CSS -framework html structure. - -*/ - -div.ethical-sidebar, -div.ethical-footer { - display: block !important; -} -.ethical-sidebar, -.ethical-footer { - padding: 0.5em; - margin: 1em 0; -} -.ethical-sidebar img, -.ethical-footer img { - width: 120px; - height: 90px; - display: inline-block; -} -.ethical-sidebar .ethical-callout, -.ethical-footer .ethical-callout { - padding-top: 1em; - clear: both; -} -.ethical-sidebar .ethical-pixel, -.ethical-footer .ethical-pixel, -.ethical-fixedfooter .ethical-pixel { - display: none !important; -} -.ethical-sidebar .ethical-text, -.ethical-footer .ethical-text { - margin-top: 1em; -} -.ethical-sidebar .ethical-image-link, -.ethical-footer .ethical-image-link { - border: 0; -} - -.ethical-sidebar, -.ethical-footer { - background-color: #eee; - border: 1px solid #ccc; - border-radius: 5px; - color: #0a0a0a; - font-size: 14px; - line-height: 20px; -} - -/* Techstack badging */ -.ethical-sidebar ul { - margin: 0 !important; - padding-left: 0; - list-style: none; -} -.ethical-sidebar ul li { - display: inline-block; - background-color: lightskyblue; - color: black; - padding: 0.25em 0.4em; - font-size: 75%; - font-weight: 700; - margin: 0.25em; - border-radius: 0.25rem; - text-align: center; - vertical-align: baseline; - white-space: nowrap; - line-height: 1.41; -} -.ethical-sidebar ul li:not(:last-child) { - margin-right: .25rem; -} - -.ethical-sidebar a, -.ethical-sidebar a:visited, -.ethical-sidebar a:hover, -.ethical-sidebar a:active, -.ethical-footer a, -.ethical-footer a:visited, -.ethical-footer a:hover, -.ethical-footer a:active { - color: #0a0a0a; - text-decoration: none !important; - border-bottom: 0 !important; -} - -.ethical-callout a { - color: #707070 !important; - text-decoration: none !important; -} - -/* Sidebar promotions */ -.ethical-sidebar { - text-align: center; - max-width: 300px; - margin-left: auto; - margin-right: auto; -} - -/* Footer promotions */ -.ethical-footer { - text-align: left; - - font-size: 14px; - line-height: 20px; -} -.ethical-footer img { - float: right; - margin-left: 25px; -} -.ethical-footer .ethical-callout { - text-align: center; -} -.ethical-footer small { - font-size: 10px; -} - -/* Fixed footer promotions */ -.ethical-fixedfooter { - box-sizing: border-box; - position: fixed; - bottom: 0; - left: 0; - z-index: 100; - background-color: #eee; - border-top: 1px solid #bfbfbf; - font-size: 12px; - line-height: 1.5; - padding: 0.5em 1.5em; - text-align: center; - color: #404040; - width: 100%; /* Fallback for Opera Mini */ - width: 100vw; -} -@media (min-width: 769px) { - /* Improve viewing on non-mobile */ - .ethical-fixedfooter { - font-size: 13px; - padding: 1em 1.5em; - } -} -.ethical-fixedfooter .ethical-text:before { - margin-right: 4px; - padding: 2px 6px; - border-radius: 3px; - background-color: #4caf50; - color: #fff; - content: "Sponsored"; -} -.ethical-fixedfooter .ethical-callout { - color: #999; - padding-left: 6px; - white-space: nowrap; -} -.ethical-fixedfooter a, -.ethical-fixedfooter a:hover, -.ethical-fixedfooter a:active, -.ethical-fixedfooter a:visited { - color: #404040; - text-decoration: none; -} -.ethical-fixedfooter .ethical-close { - position: absolute; - top: 0; - right: 5px; - font-size: 20px; - line-height: 20px; -} - -/* Use mdbook theme colors. */ - -.ethical-sidebar { - border: none; - box-shadow: none; - background: var(--sidebar-bg); -} - -.ethical-sidebar:hover { - background: var(--sidebar-non-existant); -} - -.ethical-sidebar a { - color: var(--sidebar-fg); -} diff --git a/doc/theme/index.hbs b/doc/theme/index.hbs index e8e23aa..a7cef8e 100644 --- a/doc/theme/index.hbs +++ b/doc/theme/index.hbs @@ -112,7 +112,7 @@