105 lines
2.2 KiB
JavaScript
105 lines
2.2 KiB
JavaScript
const fs = require('fs')
|
|
const base = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/renderer/src/'
|
|
function patch(file, pairs) {
|
|
const p = base + file
|
|
let c = fs.readFileSync(p, 'utf8')
|
|
for (const [from, to] of pairs) {
|
|
if (!c.includes(from)) {
|
|
console.log('MISS in', file, '::', from.slice(0, 70).replace(/\n/g, '\\n'))
|
|
continue
|
|
}
|
|
c = c.replace(from, to)
|
|
}
|
|
fs.writeFileSync(p, c, 'utf8')
|
|
}
|
|
|
|
// 1) 按视图给 body 打标记,让透明窗口强制透明
|
|
patch('main.tsx', [
|
|
[
|
|
`const view = new URLSearchParams(window.location.search).get('view')`,
|
|
`const view = new URLSearchParams(window.location.search).get('view')
|
|
document.body.dataset.view = view ?? 'pet'`
|
|
]
|
|
])
|
|
|
|
// 2) 透明窗口强制透明 + 日间按钮/日志配色
|
|
{
|
|
const p = base + 'style.css'
|
|
let c = fs.readFileSync(p, 'utf8')
|
|
c += `
|
|
|
|
/* 覆盖层窗口(桌宠/底栏/对话条/气泡)永远保持透明,避免主题切换时露出白底 */
|
|
body[data-view='pet'],
|
|
body[data-view='menu'],
|
|
body[data-view='chat'],
|
|
body[data-view='bubble'],
|
|
body[data-view='pet'] #root,
|
|
body[data-view='menu'] #root,
|
|
body[data-view='chat'] #root,
|
|
body[data-view='bubble'] #root {
|
|
background: transparent !important;
|
|
}
|
|
`
|
|
fs.writeFileSync(p, c, 'utf8')
|
|
}
|
|
{
|
|
const p = base + 'panel/panel.css'
|
|
let c = fs.readFileSync(p, 'utf8')
|
|
c += `
|
|
|
|
/* 日间模式:小按钮与图标按钮 */
|
|
[data-theme='day'] .mini {
|
|
background: #e8f0fb;
|
|
border-color: #cfd8e6;
|
|
color: #1b2434;
|
|
}
|
|
|
|
[data-theme='day'] .mini:hover {
|
|
background: #d8e6f7;
|
|
color: #0f3f66;
|
|
}
|
|
|
|
[data-theme='day'] .mini:disabled {
|
|
background: #eef2f8;
|
|
color: #9aa7ba;
|
|
}
|
|
|
|
[data-theme='day'] .icon-btn {
|
|
color: #55627a;
|
|
}
|
|
|
|
[data-theme='day'] .icon-btn:hover {
|
|
color: #1b2434;
|
|
background: #e3ecf8;
|
|
}
|
|
`
|
|
fs.writeFileSync(p, c, 'utf8')
|
|
}
|
|
{
|
|
const p = base + 'detail/detail.css'
|
|
let c = fs.readFileSync(p, 'utf8')
|
|
c += `
|
|
|
|
/* 日间模式:活动日志等列表文字 */
|
|
[data-theme='day'] .row {
|
|
background: #ffffff;
|
|
border-color: #e6ecf5;
|
|
}
|
|
|
|
[data-theme='day'] .row-title {
|
|
color: #1b2434;
|
|
}
|
|
|
|
[data-theme='day'] .row-sub {
|
|
color: #55627a;
|
|
}
|
|
|
|
[data-theme='day'] .empty {
|
|
color: #6b7890;
|
|
}
|
|
`
|
|
fs.writeFileSync(p, c, 'utf8')
|
|
}
|
|
|
|
console.log('transparent + day styles patched')
|