feat: add dark mode support for account settings page(帳號中心頁)

This commit is contained in:
Hakadao
2024-07-10 15:55:42 +08:00
parent a079a8d63a
commit 1364fa1269
4 changed files with 50 additions and 1 deletions

View File

@@ -67,8 +67,10 @@ function isSupportedPages() {
|| /https?:\/\/(?:www\.)?bilibili\.com\/read\/(?!pcpreview).*/.test(currentUrl)
// 404 page
|| /^https?:\/\/(?:www\.)?bilibili\.com\/404.*$/.test(currentUrl)
// creative center page
// creative center page 創作中心頁
|| /^https?:\/\/member\.bilibili\.com\/platform.*$/.test(currentUrl)
// account settings page 帳號中心頁
|| /^https?:\/\/account\.bilibili\.com\/.*$/.test(currentUrl)
) {
return true
}

View File

@@ -53,6 +53,7 @@ export async function getManifest() {
'*://space.bilibili.com/*',
'*://message.bilibili.com/*',
'*://member.bilibili.com/*',
'*://account.bilibili.com/*',
'*://www.hdslb.com/*',
],
js: ['./dist/contentScripts/index.global.js'],

View File

@@ -0,0 +1,41 @@
.bewly-design.accountSettingsPage {
// #region theme color adaption part
// Increase the priority of the style inside by writing a non-existent selector in `:not()`
:not(foobar) {
// do nothing..
}
// #endregion
// #region dark mode adaption part
&.dark {
.top-img,
.top_bg {
filter: invert(1) hue-rotate(180deg);
}
.security_content {
filter: invert(0.98) hue-rotate(180deg) brightness(1.1);
img,
video,
iframe,
[style*="background-image: url"],
[style*="background: url"],
.invitation-img {
filter: invert(0.98) hue-rotate(180deg) brightness(1.1);
}
}
.mp-img {
background-color: black;
}
.xts,
.table-normal *,
.record-login-descript,
.black-btn:not(:hover) {
color: black;
}
}
// #endregion
}

View File

@@ -133,6 +133,11 @@ async function setupStyles() {
// })
// })
}
// account settings page
else if (/^https?:\/\/account\.bilibili\.com\/.*$/.test(currentUrl)) {
await import('./accountSettingsPage.scss')
document.documentElement.classList.add('accountSettingsPage')
}
}
setupStyles()