-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguide.js
More file actions
21 lines (19 loc) · 794 Bytes
/
Copy pathguide.js
File metadata and controls
21 lines (19 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// function to apply the theme, sets css attributes for the theme and mode
function applyTheme(theme, mode) {
const fullTheme = `${theme}-${mode}`;
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.setAttribute('data-mode', mode);
}
//checks stored themes and loads with applytheme.
function loadSavedTheme() {
chrome.storage.sync.get(['theme', 'mode'], function(data) {
if (data.theme && data.mode) {
applyTheme(data.theme, data.mode);
} else {
//default to default-light theme if no theme is saved
applyTheme('default', 'light');
}
});
}
// call the function to load and apply the saved theme when the page loads
document.addEventListener('DOMContentLoaded', loadSavedTheme);