Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for various bugs (scrollbar, focus, cascades), style improvements #560

Merged
merged 7 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/crate/theme/rtd/crate/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<body>
{% block body %}
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
document.documentElement.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
{% endblock %}

Expand Down
6 changes: 3 additions & 3 deletions src/crate/theme/rtd/crate/partials/_head_css_variables.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
{%- endmacro %}

<style>
body {
html {
--color-code-background: #f8f8f8;
--color-code-foreground: black;
}

@media not print {
body[data-theme="dark"] {
html[data-theme="dark"] {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
html:not([data-theme="light"]) {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/crate/theme/rtd/crate/sidebartoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<!-- Search. -->
<li>
<div class="search-link">
<div id="docsearch"></div>
<div id="docsearch" style="min-height: 36px; margin-bottom: 20px;"></div>
</div>
</li>

Expand Down
55 changes: 41 additions & 14 deletions src/crate/theme/rtd/crate/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
--docsearch-primary-color: #009fc7 !important;
}

html[data-theme="dark"] {
color-scheme: dark;
}

html[data-theme="light"] {
color-scheme: light;
}

@font-face {
font-family: "Inter";
font-style: normal;
Expand Down Expand Up @@ -1151,20 +1159,6 @@ strong {
}
}

@media all and (max-width: 540px) {
.notif-bar-enabled {
margin-bottom: 180px;
}

dl.field-list {
grid-template-columns: none;
}

dl.field-list > dt {
margin: 10px 0 5px;
}
}

/* newsletter footer */
.align-items-center {
-webkit-box-align: center !important;
Expand Down Expand Up @@ -1790,6 +1784,15 @@ html .sd-tab-set > label:hover {
color: var(--color-link) !important;
}

/* tables on mobile */
@media (max-width: 768px) {
#main-content section table {
max-width: 100vw;
overflow-y: scroll;
display: block;
}
}

/* algolia */
#hits .ais-Hits-item {
background: var(--color-background-primary);
Expand All @@ -1807,6 +1810,10 @@ html .sd-tab-set > label:hover {
color: var(--color-foreground-primary);
}

.DocSearch-SearchBar :focus-visible {
outline: none;
}

@media (max-width: 768px) {
#menu-main-navigation {
display: none;
Expand All @@ -1816,3 +1823,23 @@ html .sd-tab-set > label:hover {
overflow-y: scroll;
}
}

@media all and (max-width: 540px) {
.notif-bar-enabled {
margin-bottom: 180px;
}

dl.field-list {
grid-template-columns: none;
max-width: 100vw;
overflow-y: scroll;
}

dl.field-list > dt {
margin: 10px 0 5px;
}

#main-content section iframe {
max-width: 100%;
}
}
2 changes: 1 addition & 1 deletion src/crate/theme/rtd/crate/static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Cookies = require('js-cookie');
document.addEventListener('DOMContentLoaded', () => {
// Function to set the theme
function setTheme(theme) {
document.body.setAttribute('data-theme', theme);
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem('theme', theme);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function setTheme(mode) {
mode = "light";
}

document.body.dataset.theme = mode;
document.documentElement.dataset.theme = mode;
localStorage.setItem("theme", mode);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ html body .only-dark
// Ignore dark-mode hints if print media.
@media not print
// Enable dark-mode, if requested.
body[data-theme="dark"]
@include colors-dark
html[data-theme="dark"]
body
@include colors-dark

html & .only-light
display: none !important
Expand All @@ -31,8 +32,9 @@ html body .only-dark

// Enable dark mode, unless explicitly told to avoid.
@media (prefers-color-scheme: dark)
body:not([data-theme="light"])
@include colors-dark
html:not([data-theme="light"])
body
@include colors-dark

html & .only-light
display: none !important
Expand All @@ -42,7 +44,7 @@ html body .only-dark
//
// Theme toggle presentation
//
body[data-theme="auto"]
html[data-theme="auto"]
.theme-toggle svg.theme-icon-when-auto-light
display: block

Expand All @@ -52,10 +54,10 @@ body[data-theme="auto"]
.theme-toggle svg.theme-icon-when-auto-light
display: none

body[data-theme="dark"]
html[data-theme="dark"]
.theme-toggle svg.theme-icon-when-dark
display: block

body[data-theme="light"]
html[data-theme="light"]
.theme-toggle svg.theme-icon-when-light
display: block
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body {
@include icons;
@include admonitions;
@include default-admonition(#651fff, "abstract");
@include default-topic(#14B8A6, "pencil");
@include default-topic(#14b8a6, "pencil");

@include colors;
}
Expand All @@ -20,35 +20,40 @@ html body .only-dark {
display: none !important;
}
// Ignore dark-mode hints if print media.
@media not print { // Enable dark-mode, if requested.
body[data-theme="dark"] {
@include colors-dark;
@media not print {
// Enable dark-mode, if requested.
html[data-theme="dark"] {
body {
@include colors-dark;
}

html & .only-light {
display: none !important;
}
.only-dark {
display: block !important;
}
// Enable dark mode, unless explicitly told to avoid.
// Enable dark mode, unless explicitly told to avoid.
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
@include colors-dark;
html:not([data-theme="light"]) {
body {
@include colors-dark;
}

html & .only-light {
display: none !important;
}
.only-dark {
display: block !important;
}
//
// Theme toggle presentation
//
//
// Theme toggle presentation
//
}
}
}
body[data-theme="auto"] {
html[data-theme="auto"] {
.theme-toggle svg.theme-icon-when-auto-light {
display: block;
}
Expand All @@ -61,13 +66,13 @@ body[data-theme="auto"] {
}
}
}
body[data-theme="dark"] {
html[data-theme="dark"] {
.theme-toggle svg.theme-icon-when-dark {
display: block;
}
}
body[data-theme="light"] {
html[data-theme="light"] {
.theme-toggle svg.theme-icon-when-light {
display: block;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
//
// Theme toggle presentation
//
body[data-theme="dark"] {
html[data-theme="dark"] {
.theme-toggle svg.theme-icon-when-dark {
display: block;
}
}

body[data-theme="light"] {
html[data-theme="light"] {
.theme-toggle svg.theme-icon-when-light {
display: block;
}
Expand Down
Loading