添加Github图标动态跟随显示模式

This commit is contained in:
yuweizzz
2021-11-26 00:25:00 +08:00
parent 4351c2ac42
commit 999d2961d2
2 changed files with 20 additions and 2 deletions

View File

@@ -1,11 +1,16 @@
function switchTheme() {
const currentStyle = currentTheme();
var iconElement = document.getElementById('github-icon');
if (currentStyle == 'light') {
setTheme('dark');
iconElement.removeAttribute('fill');
iconElement.setAttribute('class', 'octicon Header-link');
}
else {
setTheme('light');
iconElement.setAttribute('fill', '#24292e');
iconElement.setAttribute('class', 'Header-link');
}
}
@@ -25,4 +30,4 @@ function currentTheme() {
(() => {
setTheme(currentTheme());
})();
})();