🎨 Improve macOS initialization UI and dark mode support (#16839)

- Add dark mode styles (prefers-color-scheme)
- Optimize macOS window styling (native frame, transparent background)
- Adjust drag region height and position for macOS
- Add Portuguese (Brazil) and Korean language options
- Improve workspace path warning message
- Filter .DS_Store file
This commit is contained in:
Jeffrey Chen 2026-01-17 22:26:22 +08:00 committed by GitHub
parent 275bdaa7fc
commit a5e40b2e8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 92 additions and 5 deletions

View file

@ -3,6 +3,7 @@
<head>
<title>SiYuan</title>
<meta charset="UTF-8">
<meta name="color-scheme" content="light dark">
<style>
body {
margin: 0;
@ -181,12 +182,87 @@
.drag {
-webkit-app-region: drag;
height: 22px;
height: 32px;
cursor: pointer;
position: fixed;
top: 0;
left: 0;
right: 44px;
right: 64px;
}
.darwin #min,
.darwin #close {
display: none;
}
.darwin .drag {
left: 74px;
}
@media (prefers-color-scheme: dark) {
body {
background-color: #1e1e1e;
color: #dadada;
}
.fn__flex-column {
border: 1px solid rgba(255, 255, 255, .06);
}
.b3-select {
border: 1px solid rgba(255, 255, 255, .06);
color: #dadada;
background-color: #2d2d2d;
}
.b3-select:focus {
border: 1px solid #3573f0;
}
.b3-label {
border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.b3-label__text {
color: #9aa0a6;
}
.svg {
fill: #9aa0a6;
}
.svg:hover {
background: rgba(255, 255, 255, .075);
fill: #dadada;
}
#close:hover {
background-color: #d23f31;
fill: #fff;
}
a {
color: #3573f0;
}
a:hover {
color: #4a8aff;
}
.slogan {
color: #9aa0a6;
}
.notice {
color: #9aa0a6;
}
kbd {
color: #9aa0a6;
background-color: #2d2d2d;
border: solid 1px rgba(255, 255, 255, .06);
box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06);
}
}
</style>
</head>
@ -215,6 +291,7 @@
<option value="ja_JP">日本語</option>
<option value="ko_KR">한국어</option>
<option value="pl_PL">Polski</option>
<option value="pt_BR">Português (Brasil)</option>
<option value="ru_RU">Русский</option>
<option value="tr_TR">Türkçe</option>
<option value="zh_CHT">繁體中文</option>
@ -265,7 +342,9 @@
<option value="he_IL">עברית</option>
<option value="it_IT">Italiano</option>
<option value="ja_JP">日本語</option>
<option value="ko_KR">한국어</option>
<option value="pl_PL">Polski</option>
<option value="pt_BR">Português (Brasil)</option>
<option value="ru_RU">Русский</option>
<option value="tr_TR">Türkçe</option>
<option value="zh_CHT">繁體中文</option>
@ -355,6 +434,10 @@
})
})
if (process.platform === 'darwin') {
document.body.classList.add('darwin');
}
document.getElementById('close').addEventListener('click', () => {
const {ipcRenderer} = require('electron')
ipcRenderer.send('siyuan-first-quit')
@ -421,9 +504,9 @@
alert(msg)
return
}
let msg = '⚠️ Do not set the workspace under the path of a third-party sync disk, otherwise the data will be damaged (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.), continue?'
let msg = '⚠️ Please confirm that the workspace is not set under the path of a third-party sync disk, otherwise it will cause data damage (iCloud/OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.), continue?'
if (isChinese(currentLang)) {
msg = '⚠️ 请将工作空间设置在第三方同步盘路径下,否则数据会被损坏iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等),是否继续?'
msg = '⚠️ 请确认没有将工作空间设置在第三方同步盘路径下,否则会造成数据损坏iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等),是否继续?'
}
if (!confirm(msg)) {
return
@ -449,6 +532,7 @@
let files;
try {
files = fs.readdirSync(absPath)
files = files.filter(file => file !== '.DS_Store')
} catch (err) {
return false
}

View file

@ -1272,8 +1272,11 @@ app.whenReady().then(() => {
const firstOpenWindow = new BrowserWindow({
width: Math.floor(screen.getPrimaryDisplay().size.width * 0.6),
height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8),
frame: false,
frame: "darwin" === process.platform,
titleBarStyle: "hidden",
fullscreenable: false,
icon: path.join(appDir, "stage", "icon-large.png"),
transparent: "darwin" === process.platform,
webPreferences: {
nodeIntegration: true, webviewTag: true, webSecurity: false, contextIsolation: false,
},