mirror of
https://github.com/MeiK2333/github-style.git
synced 2025-10-07 10:04:04 +00:00
@@ -1,16 +1,20 @@
|
|||||||
function switchTheme() {
|
function switchTheme() {
|
||||||
const currentStyle = currentTheme();
|
const currentStyle = currentTheme();
|
||||||
var iconElement = document.getElementById('github-icon');
|
const iconElement = document.getElementById('github-icon');
|
||||||
|
|
||||||
if (currentStyle == 'light') {
|
if (currentStyle === 'light') {
|
||||||
setTheme('dark');
|
setTheme('dark');
|
||||||
iconElement.setAttribute('class', 'octicon');
|
if (iconElement) {
|
||||||
iconElement.setAttribute('color', '#f0f6fc');
|
iconElement.setAttribute('class', 'octicon');
|
||||||
|
iconElement.setAttribute('color', '#f0f6fc');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTheme('light');
|
setTheme('light');
|
||||||
iconElement.removeAttribute('color');
|
if (iconElement) {
|
||||||
iconElement.removeAttribute('class');
|
iconElement.removeAttribute('color');
|
||||||
|
iconElement.removeAttribute('class');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user