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') } // Menu:保存 tabIcons patch('menu/Menu.tsx', [ [ ` const [flavor, setFlavor] = useState<'chemistry' | 'normal'>('chemistry')`, ` const [flavor, setFlavor] = useState<'chemistry' | 'normal'>('chemistry')\n const [tabIcons, setTabIcons] = useState>({})` ], [ ` const applyTheme = (c: { theme: string; accent: string }): void => { document.documentElement.dataset.theme = c.theme`, ` const applyTheme = (c: { theme: string accent: string tabIcons?: Record }): void => { setTabIcons(c.tabIcons ?? {}) document.documentElement.dataset.theme = c.theme` ], [ ` {cfg?.tabIcons?.[c.id] && ( )}`, ` {tabIcons[c.id] && }` ] ]) // Editor:新增「界面」页签(底栏图标) patch('editor/Editor.tsx', [ [ "type Tab = 'item' | 'job' | 'level' | 'lyric'", "type Tab = 'item' | 'job' | 'level' | 'lyric' | 'ui'" ], [ " const [customDirty, setCustomDirty] = useState(false)", ` const [customDirty, setCustomDirty] = useState(false) const [tabIcons, setTabIcons] = useState>({}) const [uiTab, setUiTab] = useState('feed')` ], [ ` setLyric({ lyricBg: c.lyricBg, lyricColor: c.lyricColor, lyricOutline: c.lyricOutline, lyricSize: c.lyricSize })`, ` setLyric({ lyricBg: c.lyricBg, lyricColor: c.lyricColor, lyricOutline: c.lyricOutline, lyricSize: c.lyricSize }) setTabIcons(c.tabIcons ?? {})` ], [ ` ['lyric', '歌词浮窗']`, ` ['lyric', '歌词浮窗'], ['ui', '界面']` ], // 界面页:底栏图标设置 [ ` {tab === 'lyric' && (`, ` {tab === 'ui' && ( <>
底栏按钮
当前图标
选一个表情包作为这个按钮的图标:
{[ '1.0.png','2.0.png','3.0.png','4.0.png','5.0.png','6.0.png','7.0.png', '8.0.png','9.0.png','10.02.png','11.2.png','16.0.png','20.0.png','23.1.png' ].map((name) => ( ))}
)} {tab === 'lyric' && (` ] ]) // 样式:tab 图标 + 表情包网格 { const p = base + 'editor/editor.css' let c = fs.readFileSync(p, 'utf8') c += ` .sticker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; } .sticker-cell { padding: 0; border: 1px solid #2b3648; border-radius: 10px; background: transparent; cursor: pointer; overflow: hidden; aspect-ratio: 1; } .sticker-cell img { width: 100%; height: 100%; object-fit: cover; display: block; } .sticker-cell.on { border-color: #2f9cf0; box-shadow: 0 0 0 2px #2f9cf0 inset; } [data-theme='day'] .sticker-cell { border-color: #cfd8e6; } ` fs.writeFileSync(p, c, 'utf8') } { const p = base + 'panel/panel.css' let c = fs.readFileSync(p, 'utf8') c += ` .tab-icon { width: 17px; height: 17px; object-fit: cover; border-radius: 4px; margin-right: 4px; vertical-align: -3px; } ` fs.writeFileSync(p, c, 'utf8') } console.log('ui icons editor patched')