Skip to content

Commit

Permalink
[Doc] Theme revamp: styling changes
Browse files Browse the repository at this point in the history
Signed-off-by: pdmurray <peynmurray@gmail.com>
  • Loading branch information
peytondmurray committed Jan 10, 2024
1 parent 9c1920f commit dbf654f
Show file tree
Hide file tree
Showing 8 changed files with 313 additions and 299 deletions.
2 changes: 2 additions & 0 deletions doc/source/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ html[data-theme='dark'] {
--pst-color-text-muted: #b3b9c4;
--heading-color: #ffffff;
--base-pygments-code-color: #cccccc;
--pst-color-link-hover: #cce0ff;
}

html[data-theme='light'] {
Expand All @@ -33,6 +34,7 @@ html[data-theme='light'] {
--pst-color-text-muted: #454f59;
--heading-color: #161a1d;
--base-pygments-code-color: #cccccc;
--pst-color-link-hover: #09326c;
}

nav.bd-links li > a:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

.tab-pane pre {
margin: 0;
padding: 0;
padding: 0.5em 1em;
max-height: 252px;
overflow-y: auto;
animation: fadeEffect 1s; /* Fading effect takes 1 second */
Expand Down
52 changes: 52 additions & 0 deletions doc/source/_static/js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
function animateTabs() {
const tabs = Array.from(document.getElementById('v-pills-tab').children);
const contentTabs = Array.from(
document.getElementById('v-pills-tabContent').children,
);

tabs.forEach((item, index) => {
item.onclick = () => {
tabs.forEach((tab, i) => {
if (i === index) {
item.classList.add('active');
} else {
tab.classList.remove('active');
}
});
contentTabs.forEach((tab, i) => {
if (i === index) {
tab.classList.add('active', 'show');
} else {
tab.classList.remove('active', 'show');
}
});
};
});
}

function updateHighlight() {
const {theme} = document.documentElement.dataset;
['dark', 'light'].forEach((title) => {
const stylesheet = document.querySelector(`link[title="${title}"]`);
if (title === theme) {
stylesheet.removeAttribute('disabled');
} else {
stylesheet.setAttribute('disabled', 'disabled');
}
});
}

function setHighlightListener() {
const observer = new MutationObserver((mutations) => updateHighlight());
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ['data-theme'],
});
}

document.addEventListener('DOMContentLoaded', animateTabs);
document.addEventListener('DOMContentLoaded', () => {
hljs.highlightAll();
updateHighlight();
});
document.addEventListener('DOMContentLoaded', setHighlightListener);
48 changes: 0 additions & 48 deletions doc/source/_static/js/splash.js

This file was deleted.

Loading

0 comments on commit dbf654f

Please sign in to comment.