-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dark mode fix for dependency graph node text color
- Loading branch information
Showing
4 changed files
with
98 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const lightTextColor = "#212529"; | ||
const darkTextColor = "#ccc"; | ||
const lightLineColor = "#f8f9fa"; | ||
const darkLineColor = "#343a40"; | ||
|
||
function toggleDarkMode() { | ||
let isDark = document.body.classList.toggle('dark-mode'); | ||
localStorage.setItem('darkMode', isDark ? 'enabled' : 'disabled'); | ||
} | ||
document.addEventListener('DOMContentLoaded', (event) => { | ||
let isDark = (localStorage.getItem('darkMode') || 'disabled') === 'enabled'; | ||
document.getElementById("darkModeSwitch").checked = isDark; | ||
if (isDark) { | ||
toggleDarkMode(); | ||
} | ||
}); | ||
|
||
function getTextColor() { | ||
return isDark() ? darkTextColor : lightTextColor; | ||
} | ||
|
||
function getLineColor() { | ||
return isDark() ? darkLineColor : lightLineColor; | ||
} | ||
|
||
function isDark() { | ||
return ( | ||
document.getElementById("darkModeSwitch").checked || | ||
localStorage.getItem('darkMode') === 'enabled' | ||
); | ||
} |
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