优化透明窗口边框显示效果,修复全屏模式下的相关问题

This commit is contained in:
lyswhut
2026-09-19 00:29:30 +08:00
parent e9bc6a572b
commit e20b2844fb
5 changed files with 63 additions and 30 deletions
+5 -2
View File
@@ -99,8 +99,11 @@ body {
.disableTransparent {
background-color: var(--color-content-background);
#body {
border: 1Px solid var(--color-primary-light-500);
&.linux #body {
border: 1px solid var(--color-primary-light-500);
}
&.windows:not(.windows-11, .fullscreen) #body {
border-top: 1px solid #aaa;
}
#right {
+27 -23
View File
@@ -15,31 +15,35 @@
<div id="root" style="display: none;">
</div>
<script>
const formatLang = (lang = 'en') => {
if (lang === 'zh-cn') return 'zh-Hans'
if (lang === 'zh-tw') return 'zh-Hant'
return lang.split('-')[0]
}
window.setLang = (lang = navigator.language.toLocaleLowerCase()) => {
document.documentElement.setAttribute('lang', formatLang(lang))
}
window.setLang()
document.documentElement.classList.add(/os=(\w+)/.exec(window.location.search)[1])
window.shouldUseDarkColors = /dark=true/.test(window.location.search)
window.dt = /dt=true/.test(window.location.search)
document.documentElement.classList.add(window.dt ? 'disableTransparent' : 'transparent')
(() => {
const formatLang = (lang = 'en') => {
if (lang === 'zh-cn') return 'zh-Hans'
if (lang === 'zh-tw') return 'zh-Hant'
return lang.split('-')[0]
}
window.setLang = (lang = navigator.language.toLocaleLowerCase()) => {
document.documentElement.setAttribute('lang', formatLang(lang))
}
window.setLang()
const os = /os=(\w+)/.exec(window.location.search)?.[1]
const osver = decodeURIComponent(/osver=([^&]+)/.exec(window.location.search)?.[1] || '')
document.documentElement.classList.add(os, `${os}-${osver}`)
window.shouldUseDarkColors = /dark=true/.test(window.location.search)
window.dt = /dt=true/.test(window.location.search)
document.documentElement.classList.add(window.dt ? 'disableTransparent' : 'transparent')
window.dom_style = document.createElement('style')
window.dom_style = document.createElement('style')
window.setTheme = colors => {
window.dom_style.innerText = `:root {${(Object.entries(colors)).map(([key, value]) => `${key}:${value};`).join('')}}`
}
const applyThemeColor = (theme) => {
theme = JSON.parse(decodeURIComponent(theme))
window.setTheme(theme.colors)
document.body.appendChild(window.dom_style)
}
if (/theme=(.+)(#|$)/.test(window.location.search)) applyThemeColor(RegExp.$1)
window.setTheme = colors => {
window.dom_style.innerText = `:root {${(Object.entries(colors)).map(([key, value]) => `${key}:${value};`).join('')}}`
}
const applyThemeColor = (theme) => {
theme = JSON.parse(decodeURIComponent(theme))
window.setTheme(theme.colors)
document.body.appendChild(window.dom_style)
}
if (/theme=(.+)(#|$)/.test(window.location.search)) applyThemeColor(RegExp.$1)
})()
</script>
</body>
</html>