-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* css and className changes for color mode * docs color mode theme switch * lint * Added more info on themes * Update docs/components_page/components/form.md Co-authored-by: Tom Begley <[email protected]> * fixed stack style * align theme toggle to right & format as btn * lint * fixed stack examples * make examples pages always a light theme --------- Co-authored-by: Tom Begley <[email protected]>
- Loading branch information
Showing
13 changed files
with
139 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const getStoredTheme = () => localStorage.getItem('theme') | ||
const lightIcon = "bi bi-sun-fill" | ||
const darkIcon = "bi bi-moon-fill" | ||
|
||
|
||
const setIcon = theme => { | ||
icon = theme == "light" ? lightIcon : darkIcon | ||
document.getElementById('theme-icon').className = icon | ||
} | ||
|
||
const handleThemeChange = () => { | ||
getStoredTheme() == 'dark' ? setTheme("light") : setTheme("dark") | ||
} | ||
|
||
const setTheme = theme => { | ||
document.documentElement.setAttribute('data-bs-theme', theme) | ||
localStorage.setItem('theme', theme) | ||
setIcon(theme) | ||
} | ||
|
||
// icon needs to be set after page is loaded | ||
const setInitialIcon = () => { | ||
getStoredTheme() == 'dark' ? setIcon("dark") : setIcon("light") | ||
} | ||
window.onload = (event) => { | ||
// example pages should always be light theme | ||
if (window.location.pathname.includes("/examples") ) { | ||
return document.documentElement.setAttribute('data-bs-theme', "light") | ||
} | ||
setInitialIcon() | ||
|
||
}; | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,9 @@ | |
<link rel="stylesheet" href="/static/docs.css" /> | ||
<link rel="shortcut icon" type="image/png" href="/static/images/dbciconwhite16.png" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" /> | ||
|
||
<!-- sets correct theme on page refresh --> | ||
<script> | ||
dbcdStoredTheme = localStorage.getItem('theme') | ||
document.documentElement.setAttribute('data-bs-theme', dbcdStoredTheme) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script> | ||
<script src="/static/js/highlight.min.js"></script> | ||
<script src="/static/js/docs-theme-change.js"></script> | ||
<script> | ||
hljs.configure({ignoreUnescapedHTML: true}) | ||
hljs.highlightAll() | ||
|