From 999d2961d25be7f5975a0b7590c5584edd7229cd Mon Sep 17 00:00:00 2001 From: yuweizzz Date: Fri, 26 Nov 2021 00:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Github=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=B7=9F=E9=9A=8F=E6=98=BE=E7=A4=BA=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/partials/user-profile.html | 15 ++++++++++++++- static/js/theme-mode.js | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/layouts/partials/user-profile.html b/layouts/partials/user-profile.html index add5ddb..6cdd368 100644 --- a/layouts/partials/user-profile.html +++ b/layouts/partials/user-profile.html @@ -108,7 +108,10 @@

Organizations

{{ if .Site.Params.github}} - @github + + + + {{ end }} @@ -190,4 +193,14 @@ window.onscroll = function (e) { document.querySelector('#headerStuck').classList.remove('is-stuck'); } }; +var style = localStorage.getItem('data-color-mode'); +iconElement = document.getElementById('github-icon'); +if (style == 'light') { + iconElement.setAttribute('fill', '#24292e'); + iconElement.setAttribute('class', 'Header-link'); +} +else { + iconElement.removeAttribute('fill'); + iconElement.setAttribute('class', 'octicon Header-link'); +} diff --git a/static/js/theme-mode.js b/static/js/theme-mode.js index 58b58a1..c1f9bab 100644 --- a/static/js/theme-mode.js +++ b/static/js/theme-mode.js @@ -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()); -})(); \ No newline at end of file +})();