dsh-theme-gruvbox 0.0.0-stage → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +85 -2
- package/client.js +503 -0
- package/cordis.patch.yml +4 -0
- package/docs/DETAIL.md +133 -0
- package/docs/preview.png +0 -0
- package/docs/screenshots/dark-hard.png +0 -0
- package/docs/screenshots/dark-medium.png +0 -0
- package/docs/screenshots/dark-soft.png +0 -0
- package/docs/screenshots/material-soft.png +0 -0
- package/icon.svg +6 -0
- package/index.js +10 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +39 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 newbeebird
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-theme-gruvbox
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/newbeebird/dsh-theme-gruvbox/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/newbeebird/dsh-theme-gruvbox/releases)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/newbeebird/dsh-theme-gruvbox)
|
|
7
|
+
|
|
8
|
+
给 DeepSeek Harness 的 Gruvbox 暖色复古主题。Gruvbox 是 2012 年 Vim 社区的配色,底色偏暖,强调色是橙、黄、红、绿。
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
## 界面预览
|
|
13
|
+
|
|
14
|
+
按各档配色绘制的示意图,不是真实截屏:
|
|
15
|
+
|
|
16
|
+
| Dark Hard | Dark Medium |
|
|
17
|
+
|---|---|
|
|
18
|
+
|  |  |
|
|
19
|
+
|
|
20
|
+
| Dark Soft | Material Soft |
|
|
21
|
+
|---|---|
|
|
22
|
+
|  |  |
|
|
23
|
+
|
|
24
|
+
## 特性
|
|
25
|
+
|
|
26
|
+
- 4 个暗色档:Dark Hard / Dark Medium / Dark Soft / Material Soft
|
|
27
|
+
- 设置页切换,选择存本地
|
|
28
|
+
- 语法高亮独立选项:跟随主题 / DSH 默认 / Gruvbox 经典 / Gruvbox Material
|
|
29
|
+
- Ctrl + / Ctrl − 调字体不会回退
|
|
30
|
+
- 输入框和聊天框保持 DSH 默认;代码块、文件编辑卡片按主题背景加深一档
|
|
31
|
+
- 成本面板平价段绿色,峰时段保持原生橙
|
|
32
|
+
- 纯 CSS 变量 + 静态样式,无动画、无模糊
|
|
33
|
+
|
|
34
|
+
## 安装
|
|
35
|
+
|
|
36
|
+
### 从 Release(推荐)
|
|
37
|
+
|
|
38
|
+
1. 打开 [Releases](https://github.com/newbeebird/dsh-theme-gruvbox/releases),下载最新的 `dsh-theme-gruvbox-*.zip`;
|
|
39
|
+
2. 解压;
|
|
40
|
+
3. 在 DSH 插件管理器里把解压出来的 `dsh-theme-gruvbox` 目录作为 bundle 安装(`install_bundle`);
|
|
41
|
+
4. 刷新页面。
|
|
42
|
+
|
|
43
|
+
### 从源码
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
git clone https://github.com/newbeebird/dsh-theme-gruvbox.git
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
然后把仓库目录作为 bundle 安装,刷新页面。本地使用不需要打包。
|
|
50
|
+
|
|
51
|
+
## 使用
|
|
52
|
+
|
|
53
|
+
设置 → Gruvbox 主题,点色卡切换;「跟随内置主题」可以退回 DSH 自带的浅色/深色/跟随系统。
|
|
54
|
+
|
|
55
|
+
## 说明
|
|
56
|
+
|
|
57
|
+
- 第三方主题不进入 DSH 内置设置入口,切换在插件自己的设置分区。
|
|
58
|
+
- 在 DSH 内置「外观」里切浅色/深色会覆盖 Gruvbox,点色卡可以回来。
|
|
59
|
+
- 输入框/聊天框用 DSH 默认色;代码块与文件编辑卡片用当前档背景混黑,比背景深一档。
|
|
60
|
+
- 终端选中色保持 DSH / xterm 默认。
|
|
61
|
+
- light 档已移除(多处偏白)。
|
|
62
|
+
|
|
63
|
+
## 版本记录
|
|
64
|
+
|
|
65
|
+
- `v0.1.0` 初始发布:4 暗色档、语法选项、字体守卫
|
|
66
|
+
- `v0.1.1` 代码区/卡片加深、设置页层色加深、README 预览与徽章
|
|
67
|
+
- `v0.1.2` 思考中、轨迹、活动标签统一为品牌橙
|
|
68
|
+
- `v0.1.3` 每个主题的界面预览图
|
|
69
|
+
- `v0.1.4` Credits 与非官方声明
|
|
70
|
+
- `v0.1.5` 成本面板平价段改绿、设置开关保持主题、外观切换放行
|
|
71
|
+
- `v0.1.6` 粗体字重 700、字体与界面微调
|
|
72
|
+
- `v0.1.7` 包元数据修正,支持 npm 发布
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT,见 [LICENSE](LICENSE)。
|
|
77
|
+
|
|
78
|
+
## Credits
|
|
79
|
+
|
|
80
|
+
配色灵感来自 [morhetz/gruvbox](https://github.com/morhetz/gruvbox)(MIT)。
|
|
81
|
+
|
|
82
|
+
本项目是非官方主题,与原项目无隶属关系。
|
|
83
|
+
|
|
84
|
+
## English
|
|
85
|
+
|
|
86
|
+
Gruvbox warm retro themes for DeepSeek Harness: four dark variants, a Settings switcher, independent syntax-highlight options, and a Ctrl +/- font-resize guard. The composer keeps the DSH default surface; code blocks and file-edit cards are mixed slightly darker than the theme background. Alias-token only; static CSS; no animation or blur. See [docs/DETAIL.md](docs/DETAIL.md) for the palette and limits.
|
package/client.js
ADDED
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gruvbox theme — browser half.
|
|
3
|
+
*
|
|
4
|
+
* Registers three dark Gruvbox variants (hard / medium / soft) as third-party
|
|
5
|
+
* themes through `ctx.theme`, and contributes a Settings section that switches
|
|
6
|
+
* between them. The choice is kept in localStorage because third-party theme
|
|
7
|
+
* ids are an in-process extension and do not enter the built-in settings
|
|
8
|
+
* schema.
|
|
9
|
+
*
|
|
10
|
+
* Design rules:
|
|
11
|
+
* - only alias tokens are overridden; the built-in dark palette supplies the
|
|
12
|
+
* rest;
|
|
13
|
+
* - decoration is static CSS (selection color, color-scheme); no animation,
|
|
14
|
+
* no backdrop-filter, no DOM observers;
|
|
15
|
+
* - `html[data-dsh-gruvbox]` marks the active Gruvbox theme so decoration can
|
|
16
|
+
* be scoped without touching built-in light/dark themes.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
window.__ModuleLoader__.load({
|
|
20
|
+
id: 'dsh-theme-gruvbox',
|
|
21
|
+
factory: (load) => {
|
|
22
|
+
const React = load('react')
|
|
23
|
+
const h = React.createElement
|
|
24
|
+
|
|
25
|
+
const NS = 'gruvbox-theme'
|
|
26
|
+
const STORAGE_KEY = 'dsh-theme-gruvbox:active'
|
|
27
|
+
const SYNTAX_KEY = 'dsh-theme-gruvbox:syntax'
|
|
28
|
+
const FG = '#ebdbb2'
|
|
29
|
+
const FG2 = '#a89984'
|
|
30
|
+
|
|
31
|
+
/* Gruvbox palette (2012, Vim community). */
|
|
32
|
+
const THEMES = [
|
|
33
|
+
{
|
|
34
|
+
id: 'gruvbox-dark-hard',
|
|
35
|
+
name: 'Gruvbox Dark Hard',
|
|
36
|
+
variant: 'hard',
|
|
37
|
+
bg: '#1d2021',
|
|
38
|
+
panel: '#282828',
|
|
39
|
+
nested: '#32302f',
|
|
40
|
+
border: '#504945',
|
|
41
|
+
border2: '#665c54',
|
|
42
|
+
sidebar: '#282828',
|
|
43
|
+
brand: '#fe8019',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'gruvbox-dark',
|
|
47
|
+
name: 'Gruvbox Dark Medium',
|
|
48
|
+
variant: 'medium',
|
|
49
|
+
bg: '#282828',
|
|
50
|
+
panel: '#32302f',
|
|
51
|
+
nested: '#3c3836',
|
|
52
|
+
border: '#504945',
|
|
53
|
+
border2: '#665c54',
|
|
54
|
+
sidebar: '#32302f',
|
|
55
|
+
brand: '#fe8019',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'gruvbox-dark-soft',
|
|
59
|
+
name: 'Gruvbox Dark Soft',
|
|
60
|
+
variant: 'soft',
|
|
61
|
+
bg: '#32302f',
|
|
62
|
+
panel: '#32302f',
|
|
63
|
+
nested: '#3c3836',
|
|
64
|
+
border: '#504945',
|
|
65
|
+
border2: '#665c54',
|
|
66
|
+
sidebar: '#3c3836',
|
|
67
|
+
brand: '#fe8019',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 'gruvbox-material-dark-soft',
|
|
71
|
+
name: 'Gruvbox Material Dark Soft',
|
|
72
|
+
variant: 'material-soft',
|
|
73
|
+
bg: '#32302f',
|
|
74
|
+
panel: '#32302f',
|
|
75
|
+
nested: '#3c3836',
|
|
76
|
+
border: '#5a524c',
|
|
77
|
+
border2: '#7c6f64',
|
|
78
|
+
sidebar: '#3c3836',
|
|
79
|
+
brand: '#e78a4e',
|
|
80
|
+
fg: '#ddc7a1',
|
|
81
|
+
fg2: '#bdae93',
|
|
82
|
+
error: '#ea6962',
|
|
83
|
+
success: '#a9b665',
|
|
84
|
+
warn: '#d8a657',
|
|
85
|
+
idle: '#928374',
|
|
86
|
+
},
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
const ZH = {
|
|
90
|
+
title: 'Gruvbox 主题',
|
|
91
|
+
desc: 'Vim 社区 2012 年的暖色复古配色,先提供三档暗色。切换后写入本地。',
|
|
92
|
+
current: '当前',
|
|
93
|
+
builtin: '跟随内置主题',
|
|
94
|
+
note: '内置「外观」里切回浅色/深色会覆盖 Gruvbox;想回来再点上面的色卡。',
|
|
95
|
+
'syntax.title': '语法高亮',
|
|
96
|
+
'syntax.auto': '跟随主题',
|
|
97
|
+
'syntax.default': 'DSH 默认',
|
|
98
|
+
'syntax.classic': 'Gruvbox 经典',
|
|
99
|
+
'syntax.material': 'Gruvbox Material',
|
|
100
|
+
'syntax.note': '只影响代码块配色;“跟随主题”会按当前色档自动选经典或 Material。',
|
|
101
|
+
'variant.hard': 'Hard',
|
|
102
|
+
'variant.medium': 'Medium',
|
|
103
|
+
'variant.soft': 'Soft',
|
|
104
|
+
'variant.material-soft': 'Material Soft',
|
|
105
|
+
|
|
106
|
+
unavailable: '主题服务尚未就绪,稍后再试。',
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const EN = {
|
|
110
|
+
title: 'Gruvbox themes',
|
|
111
|
+
desc: 'The 2012 Vim-community warm retro palette, starting with three dark variants. The choice is stored locally.',
|
|
112
|
+
current: 'Current',
|
|
113
|
+
builtin: 'Use built-in theme',
|
|
114
|
+
note: 'Switching Appearance back to light/dark overrides Gruvbox; pick a card above to return.',
|
|
115
|
+
'syntax.title': 'Syntax highlighting',
|
|
116
|
+
'syntax.auto': 'Follow theme',
|
|
117
|
+
'syntax.default': 'DSH default',
|
|
118
|
+
'syntax.classic': 'Gruvbox Classic',
|
|
119
|
+
'syntax.material': 'Gruvbox Material',
|
|
120
|
+
'syntax.note': 'Code-block colors only; Follow theme picks Classic or Material from the active variant.',
|
|
121
|
+
'variant.hard': 'Hard',
|
|
122
|
+
'variant.medium': 'Medium',
|
|
123
|
+
'variant.soft': 'Soft',
|
|
124
|
+
'variant.material-soft': 'Material Soft',
|
|
125
|
+
|
|
126
|
+
unavailable: 'The theme service is not ready yet; try again shortly.',
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function syntaxFor(theme, preference) {
|
|
130
|
+
if (preference === 'default') return 'default'
|
|
131
|
+
if (preference === 'classic' || preference === 'material') return preference
|
|
132
|
+
return theme !== undefined && theme.variant === 'material-soft' ? 'material' : 'classic'
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function applySyntax(theme, preference) {
|
|
136
|
+
if (preference === 'default') {
|
|
137
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox-syntax')
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
document.documentElement.setAttribute('data-dsh-gruvbox-syntax', syntaxFor(theme, preference))
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function tokensFor(theme) {
|
|
144
|
+
return {
|
|
145
|
+
'--dsw-alias-bg-base': theme.bg,
|
|
146
|
+
'--dsw-alias-bg-layer-1': theme.panel,
|
|
147
|
+
'--dsw-alias-bg-layer-2': theme.nested,
|
|
148
|
+
'--dsw-alias-bg-overlay': theme.nested,
|
|
149
|
+
'--dsw-alias-border-l1': theme.border,
|
|
150
|
+
'--dsw-alias-border-l2': theme.border2,
|
|
151
|
+
'--dsw-alias-brand-primary': theme.brand,
|
|
152
|
+
'--dsw-alias-label-primary': theme.fg ?? FG,
|
|
153
|
+
'--dsw-alias-label-secondary': theme.fg2 ?? FG2,
|
|
154
|
+
'--dsw-alias-state-error-primary': theme.error ?? '#fb4934',
|
|
155
|
+
'--dsw-alias-state-idle-primary': theme.idle ?? '#928374',
|
|
156
|
+
'--dsw-alias-state-success-primary': theme.success ?? '#b8bb26',
|
|
157
|
+
'--dsw-alias-state-warn-primary': theme.warn ?? '#fabd2f',
|
|
158
|
+
'--dsw-specific-sidebar-fill': theme.sidebar,
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const CSS = `
|
|
163
|
+
html[data-dsh-gruvbox]{color-scheme:dark}
|
|
164
|
+
html[data-dsh-gruvbox] ::selection{background:rgba(189,111,62,.55);color:#fbf1c7}
|
|
165
|
+
html[data-dsh-gruvbox] strong,
|
|
166
|
+
html[data-dsh-gruvbox] b{font-weight:700!important}
|
|
167
|
+
html[data-dsh-gruvbox] body{
|
|
168
|
+
--dsw-alias-markdown-code-block:color-mix(in srgb,var(--dsw-alias-bg-base) 84%,#000);
|
|
169
|
+
--dsw-alias-markdown-inline-code:color-mix(in srgb,var(--dsw-alias-bg-base) 92%,#000);
|
|
170
|
+
--dsw-alias-markdown-code-block-banner:color-mix(in srgb,var(--dsw-alias-bg-base) 86%,#000);
|
|
171
|
+
--dsw-alias-card-fill:color-mix(in srgb,var(--dsw-alias-bg-base) 84%,#000);
|
|
172
|
+
--dsw-alias-card-fill-hover:color-mix(in srgb,var(--dsw-alias-bg-base) 80%,#000);
|
|
173
|
+
--dsw-alias-card-tile-fill:color-mix(in srgb,var(--dsw-alias-bg-base) 84%,#000);
|
|
174
|
+
--dsw-alias-markdown-citation:color-mix(in srgb,var(--dsw-alias-bg-base) 84%,#000);
|
|
175
|
+
--dsw-alias-label-deep-diving:var(--dsw-alias-brand-primary);
|
|
176
|
+
--dsw-alias-label-deep-diving-shimmer:color-mix(in srgb,var(--dsw-alias-brand-primary) 60%,#fff);
|
|
177
|
+
--dsw-alias-trajectory-accent:var(--dsw-alias-brand-primary);
|
|
178
|
+
--dsw-alias-state-business-primary:var(--dsw-alias-brand-primary);
|
|
179
|
+
}
|
|
180
|
+
html[data-dsh-gruvbox] .cm-peak-progress:not(.peak){--peak-color:#a3d194}
|
|
181
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-variant="material-soft"] .cm-peak-progress:not(.peak){--peak-color:#9fc98f}
|
|
182
|
+
html[data-dsh-gruvbox] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-low{background:#a3d194!important}
|
|
183
|
+
html[data-dsh-gruvbox] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-track{background:color-mix(in srgb,#a3d194 18%,transparent)!important}
|
|
184
|
+
html[data-dsh-gruvbox] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-chip,
|
|
185
|
+
html[data-dsh-gruvbox] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-classic-chip{color:#a3d194!important}
|
|
186
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-variant="material-soft"] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-low{background:#9fc98f!important}
|
|
187
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-variant="material-soft"] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-track{background:color-mix(in srgb,#9fc98f 18%,transparent)!important}
|
|
188
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-variant="material-soft"] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-chip,
|
|
189
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-variant="material-soft"] :is(.cm-peak-strip,.cm-peak-classic):not(.peak) .cm-peak-classic-chip{color:#9fc98f!important}
|
|
190
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-syntax="classic"] body[data-ds-dark-theme]{
|
|
191
|
+
--shiki-token-keyword:#fb4934;
|
|
192
|
+
--shiki-token-string:#b8bb26;
|
|
193
|
+
--shiki-token-string-expression:#b8bb26;
|
|
194
|
+
--shiki-token-constant:#d3869b;
|
|
195
|
+
--shiki-token-parameter:#fe8019;
|
|
196
|
+
--shiki-token-function:#fabd2f;
|
|
197
|
+
--shiki-token-punctuation:#ebdbb2;
|
|
198
|
+
--shiki-token-comment:#928374;
|
|
199
|
+
--shiki-token-link:#83a598;
|
|
200
|
+
}
|
|
201
|
+
html[data-dsh-gruvbox][data-dsh-gruvbox-syntax="material"] body[data-ds-dark-theme]{
|
|
202
|
+
--shiki-token-keyword:#ea6962;
|
|
203
|
+
--shiki-token-string:#a9b665;
|
|
204
|
+
--shiki-token-string-expression:#a9b665;
|
|
205
|
+
--shiki-token-constant:#d3869b;
|
|
206
|
+
--shiki-token-parameter:#e78a4e;
|
|
207
|
+
--shiki-token-function:#d8a657;
|
|
208
|
+
--shiki-token-punctuation:#ddc7a1;
|
|
209
|
+
--shiki-token-comment:#7c6f64;
|
|
210
|
+
--shiki-token-link:#7daea3;
|
|
211
|
+
}
|
|
212
|
+
.gv-wrap{display:flex;flex-direction:column;gap:12px;max-width:720px;padding:4px 0 24px}
|
|
213
|
+
.gv-title{margin:0;font-size:1.2em;font-weight:600}
|
|
214
|
+
.gv-desc{margin:0;color:var(--dsw-alias-label-secondary);font-size:0.96em;line-height:1.5}
|
|
215
|
+
.gv-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
|
|
216
|
+
.gv-card{display:flex;flex-direction:column;gap:6px;padding:10px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;font:inherit}
|
|
217
|
+
.gv-card.is-active{border-color:var(--dsw-alias-brand-primary);box-shadow:inset 0 0 0 1px var(--dsw-alias-brand-primary)}
|
|
218
|
+
.gv-preview{position:relative;display:block;height:44px;border-radius:5px;border:1px solid rgba(255,255,255,.08)}
|
|
219
|
+
.gv-preview-panel{position:absolute;left:8px;top:8px;width:52%;height:12px;border-radius:3px}
|
|
220
|
+
.gv-preview-dot{position:absolute;right:8px;bottom:8px;width:12px;height:12px;border-radius:50%}
|
|
221
|
+
.gv-name{font-weight:600;font-size:1em}
|
|
222
|
+
.gv-sub{font-size:0.84em;color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Consolas,monospace}
|
|
223
|
+
.gv-badge{align-self:flex-start;font-size:0.8em;font-weight:600;padding:1px 6px;border-radius:999px;background:var(--dsw-alias-brand-primary);color:#1d2021}
|
|
224
|
+
.gv-reset{align-self:flex-start;height:26px;padding:0 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;background:transparent;color:var(--dsw-alias-label-primary);font-size:0.96em;cursor:pointer}
|
|
225
|
+
.gv-note{margin:0;color:var(--dsw-alias-label-secondary);font-size:0.88em;line-height:1.5}
|
|
226
|
+
.gv-syntax{display:flex;flex-direction:column;gap:6px;margin-top:2px}
|
|
227
|
+
.gv-label{font-weight:600;font-size:0.96em}
|
|
228
|
+
.gv-options{display:flex;flex-wrap:wrap;gap:6px}
|
|
229
|
+
.gv-opt{height:26px;padding:0 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;background:transparent;color:var(--dsw-alias-label-primary);font-size:0.92em;cursor:pointer}
|
|
230
|
+
.gv-opt.is-active{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
|
|
231
|
+
`
|
|
232
|
+
|
|
233
|
+
function GruvboxSettings(props) {
|
|
234
|
+
const { t, getService } = props
|
|
235
|
+
const [activeId, setActiveId] = React.useState(() => {
|
|
236
|
+
try { return getService()?.getTheme()?.active?.id ?? '' } catch { return '' }
|
|
237
|
+
})
|
|
238
|
+
const [syntaxPref, setSyntaxPref] = React.useState(() => {
|
|
239
|
+
try {
|
|
240
|
+
const stored = localStorage.getItem(SYNTAX_KEY)
|
|
241
|
+
return stored === 'default' || stored === 'classic' || stored === 'material' ? stored : 'auto'
|
|
242
|
+
} catch {
|
|
243
|
+
return 'auto'
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
const choose = (id) => {
|
|
248
|
+
const service = getService()
|
|
249
|
+
if (service === undefined) return
|
|
250
|
+
try {
|
|
251
|
+
service.setTheme(id)
|
|
252
|
+
} catch (error) {
|
|
253
|
+
console.error('[gruvbox] setTheme failed:', error)
|
|
254
|
+
return
|
|
255
|
+
}
|
|
256
|
+
try { localStorage.setItem(STORAGE_KEY, id) } catch { /* storage unavailable */ }
|
|
257
|
+
document.documentElement.setAttribute('data-dsh-gruvbox', '')
|
|
258
|
+
const theme = THEMES.find((entry) => entry.id === id)
|
|
259
|
+
if (theme !== undefined) {
|
|
260
|
+
document.documentElement.setAttribute('data-dsh-gruvbox-variant', theme.variant)
|
|
261
|
+
applySyntax(theme, syntaxPref)
|
|
262
|
+
}
|
|
263
|
+
setActiveId(id)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const chooseSyntax = (value) => {
|
|
267
|
+
try { localStorage.setItem(SYNTAX_KEY, value) } catch { /* storage unavailable */ }
|
|
268
|
+
setSyntaxPref(value)
|
|
269
|
+
const active = getService()?.getTheme()?.active
|
|
270
|
+
applySyntax(active, value)
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const reset = () => {
|
|
274
|
+
const service = getService()
|
|
275
|
+
if (service === undefined) return
|
|
276
|
+
try {
|
|
277
|
+
service.setTheme('system')
|
|
278
|
+
} catch (error) {
|
|
279
|
+
console.error('[gruvbox] restore built-in failed:', error)
|
|
280
|
+
return
|
|
281
|
+
}
|
|
282
|
+
try { localStorage.removeItem(STORAGE_KEY) } catch { /* storage unavailable */ }
|
|
283
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox')
|
|
284
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox-variant')
|
|
285
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox-syntax')
|
|
286
|
+
setActiveId('system')
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (getService() === undefined) {
|
|
290
|
+
return h('div', { className: 'gv-wrap' },
|
|
291
|
+
h('h2', { className: 'gv-title' }, t('title')),
|
|
292
|
+
h('p', { className: 'gv-desc' }, t('unavailable')))
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return h('div', { className: 'gv-wrap' },
|
|
296
|
+
h('h2', { className: 'gv-title' }, t('title')),
|
|
297
|
+
h('p', { className: 'gv-desc' }, t('desc')),
|
|
298
|
+
h('div', { className: 'gv-grid' }, THEMES.map((theme) => {
|
|
299
|
+
const active = activeId === theme.id
|
|
300
|
+
return h('button', {
|
|
301
|
+
key: theme.id,
|
|
302
|
+
type: 'button',
|
|
303
|
+
className: `gv-card${active ? ' is-active' : ''}`,
|
|
304
|
+
'aria-pressed': active,
|
|
305
|
+
onClick: () => choose(theme.id),
|
|
306
|
+
},
|
|
307
|
+
h('span', { className: 'gv-preview', style: { background: theme.bg } },
|
|
308
|
+
h('span', { className: 'gv-preview-panel', style: { background: theme.panel } }),
|
|
309
|
+
h('span', { className: 'gv-preview-dot', style: { background: theme.brand } })),
|
|
310
|
+
h('span', { className: 'gv-name' }, t(`variant.${theme.variant}`)),
|
|
311
|
+
h('span', { className: 'gv-sub' }, theme.name),
|
|
312
|
+
active ? h('span', { className: 'gv-badge' }, t('current')) : null)
|
|
313
|
+
})),
|
|
314
|
+
h('div', { className: 'gv-syntax' },
|
|
315
|
+
h('span', { className: 'gv-label' }, t('syntax.title')),
|
|
316
|
+
h('div', { className: 'gv-options' },
|
|
317
|
+
[
|
|
318
|
+
['auto', 'syntax.auto'],
|
|
319
|
+
['default', 'syntax.default'],
|
|
320
|
+
['classic', 'syntax.classic'],
|
|
321
|
+
['material', 'syntax.material'],
|
|
322
|
+
].map(([value, key]) => h('button', {
|
|
323
|
+
key: value,
|
|
324
|
+
type: 'button',
|
|
325
|
+
className: `gv-opt${syntaxPref === value ? ' is-active' : ''}`,
|
|
326
|
+
'aria-pressed': syntaxPref === value,
|
|
327
|
+
onClick: () => chooseSyntax(value),
|
|
328
|
+
}, t(key))))),
|
|
329
|
+
h('p', { className: 'gv-note' }, t('syntax.note')),
|
|
330
|
+
h('button', { type: 'button', className: 'gv-reset', onClick: reset }, t('builtin')),
|
|
331
|
+
h('p', { className: 'gv-note' }, t('note')))
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function apply(ctx) {
|
|
335
|
+
ctx.effect(() => {
|
|
336
|
+
const style = document.createElement('style')
|
|
337
|
+
style.setAttribute('data-dsh-theme-gruvbox', '')
|
|
338
|
+
style.textContent = CSS
|
|
339
|
+
document.head.appendChild(style)
|
|
340
|
+
return () => { style.remove() }
|
|
341
|
+
}, 'gruvbox: styles')
|
|
342
|
+
|
|
343
|
+
ctx.effect(() => ctx.locale.register(NS, { zh: ZH, en: EN }), 'gruvbox: dictionaries')
|
|
344
|
+
const t = ctx.locale.bind(NS)
|
|
345
|
+
|
|
346
|
+
let themeService
|
|
347
|
+
|
|
348
|
+
ctx.inject(['theme'], (sub) => {
|
|
349
|
+
themeService = sub.theme
|
|
350
|
+
sub.effect(() => {
|
|
351
|
+
const disposers = []
|
|
352
|
+
for (const theme of THEMES) {
|
|
353
|
+
try {
|
|
354
|
+
disposers.push(sub.theme.register({
|
|
355
|
+
id: theme.id,
|
|
356
|
+
colorScheme: theme.colorScheme ?? 'dark',
|
|
357
|
+
tokens: tokensFor(theme),
|
|
358
|
+
}))
|
|
359
|
+
} catch (error) {
|
|
360
|
+
console.error('[gruvbox] register failed:', theme.id, error)
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
try {
|
|
364
|
+
const stored = localStorage.getItem(STORAGE_KEY)
|
|
365
|
+
const restored = stored === null ? undefined : THEMES.find(theme => theme.id === stored)
|
|
366
|
+
if (restored !== undefined) {
|
|
367
|
+
sub.theme.setTheme(stored)
|
|
368
|
+
document.documentElement.setAttribute('data-dsh-gruvbox', '')
|
|
369
|
+
document.documentElement.setAttribute('data-dsh-gruvbox-variant', restored.variant)
|
|
370
|
+
let syntaxPref = 'auto'
|
|
371
|
+
try { syntaxPref = localStorage.getItem(SYNTAX_KEY) ?? 'auto' } catch { /* storage unavailable */ }
|
|
372
|
+
applySyntax(restored, syntaxPref)
|
|
373
|
+
}
|
|
374
|
+
} catch { /* storage unavailable */ }
|
|
375
|
+
|
|
376
|
+
// Ctrl +/- writes font sizes through the built-in settings scope; the
|
|
377
|
+
// third-party theme id is not persisted there, so the active theme can
|
|
378
|
+
// fall back to the built-in one. Track the shortcut and keep restoring
|
|
379
|
+
// for a short window while the settings read-back settles.
|
|
380
|
+
let lastFontSizes = sub.theme.getTheme()?.fontSizes
|
|
381
|
+
let lastFontKeyAt = 0
|
|
382
|
+
let appearanceActionAt = 0
|
|
383
|
+
let guardTimer = null
|
|
384
|
+
let settingGuardTimer = null
|
|
385
|
+
const restoreIfNeeded = () => {
|
|
386
|
+
let stored = null
|
|
387
|
+
try { stored = localStorage.getItem(STORAGE_KEY) } catch { /* storage unavailable */ }
|
|
388
|
+
const theme = THEMES.find(entry => entry.id === stored)
|
|
389
|
+
if (theme === undefined) return
|
|
390
|
+
const snapshot = sub.theme.getTheme()
|
|
391
|
+
if (snapshot?.active?.id === theme.id) return
|
|
392
|
+
try { sub.theme.setTheme(theme.id) } catch { return }
|
|
393
|
+
document.documentElement.setAttribute('data-dsh-gruvbox', '')
|
|
394
|
+
document.documentElement.setAttribute('data-dsh-gruvbox-variant', theme.variant)
|
|
395
|
+
let syntaxPref = 'auto'
|
|
396
|
+
try { syntaxPref = localStorage.getItem(SYNTAX_KEY) ?? 'auto' } catch { /* storage unavailable */ }
|
|
397
|
+
applySyntax(theme, syntaxPref)
|
|
398
|
+
}
|
|
399
|
+
const onThemeChange = () => {
|
|
400
|
+
let stored = null
|
|
401
|
+
try { stored = localStorage.getItem(STORAGE_KEY) } catch { /* storage unavailable */ }
|
|
402
|
+
const theme = THEMES.find(entry => entry.id === stored)
|
|
403
|
+
const activeId = sub.theme.getTheme()?.active?.id
|
|
404
|
+
if (theme !== undefined && activeId !== undefined && activeId !== theme.id) {
|
|
405
|
+
// Only an explicit Appearance click may abandon Gruvbox. Any other
|
|
406
|
+
// fallback (plugin toggle, settings write-back, startup) restores it.
|
|
407
|
+
if (Date.now() - appearanceActionAt < 3000) {
|
|
408
|
+
try { localStorage.removeItem(STORAGE_KEY) } catch { /* storage unavailable */ }
|
|
409
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox')
|
|
410
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox-variant')
|
|
411
|
+
document.documentElement.removeAttribute('data-dsh-gruvbox-syntax')
|
|
412
|
+
return
|
|
413
|
+
}
|
|
414
|
+
restoreIfNeeded()
|
|
415
|
+
return
|
|
416
|
+
}
|
|
417
|
+
if (Date.now() - lastFontKeyAt < 3000) {
|
|
418
|
+
restoreIfNeeded()
|
|
419
|
+
return
|
|
420
|
+
}
|
|
421
|
+
let changed = false
|
|
422
|
+
try {
|
|
423
|
+
const snapshot = sub.theme.getTheme()
|
|
424
|
+
changed = JSON.stringify(snapshot?.fontSizes) !== JSON.stringify(lastFontSizes)
|
|
425
|
+
lastFontSizes = snapshot?.fontSizes
|
|
426
|
+
} catch { return }
|
|
427
|
+
if (!changed) return
|
|
428
|
+
restoreIfNeeded()
|
|
429
|
+
}
|
|
430
|
+
const startSettingGuard = () => {
|
|
431
|
+
restoreIfNeeded()
|
|
432
|
+
if (settingGuardTimer !== null) return
|
|
433
|
+
const started = Date.now()
|
|
434
|
+
settingGuardTimer = setInterval(() => {
|
|
435
|
+
restoreIfNeeded()
|
|
436
|
+
if (Date.now() - started > 3000) {
|
|
437
|
+
clearInterval(settingGuardTimer)
|
|
438
|
+
settingGuardTimer = null
|
|
439
|
+
}
|
|
440
|
+
}, 150)
|
|
441
|
+
}
|
|
442
|
+
const onDocumentClick = (event) => {
|
|
443
|
+
const target = event.target
|
|
444
|
+
if (!(target instanceof Element)) return
|
|
445
|
+
const control = target.closest('button, [role="switch"], [role="checkbox"], input, label')
|
|
446
|
+
if (control === null) return
|
|
447
|
+
const text = (control.textContent ?? '').trim().toLowerCase()
|
|
448
|
+
if (/(浅色|深色|跟随系统|light|dark|system)/.test(text)) {
|
|
449
|
+
appearanceActionAt = Date.now()
|
|
450
|
+
return
|
|
451
|
+
}
|
|
452
|
+
const isSwitch = control.matches('[role="switch"], [role="checkbox"], input[type="checkbox"]')
|
|
453
|
+
if (isSwitch || /(启用|禁用|开启|关闭|enable|disable)/.test(text)) {
|
|
454
|
+
startSettingGuard()
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
try { document.addEventListener('click', onDocumentClick, true) } catch { /* document unavailable */ }
|
|
458
|
+
const onKeyDown = (event) => {
|
|
459
|
+
if ((event.ctrlKey || event.metaKey) && (event.key === '+' || event.key === '=' || event.key === '-' || event.key === '_')) {
|
|
460
|
+
lastFontKeyAt = Date.now()
|
|
461
|
+
if (guardTimer !== null) return
|
|
462
|
+
guardTimer = setInterval(() => {
|
|
463
|
+
restoreIfNeeded()
|
|
464
|
+
if (Date.now() - lastFontKeyAt > 3000) {
|
|
465
|
+
clearInterval(guardTimer)
|
|
466
|
+
guardTimer = null
|
|
467
|
+
}
|
|
468
|
+
}, 150)
|
|
469
|
+
restoreIfNeeded()
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
try { window.addEventListener('keydown', onKeyDown, true) } catch { /* window unavailable */ }
|
|
473
|
+
let offTheme = null
|
|
474
|
+
try { offTheme = sub.on('theme/change', onThemeChange) } catch { /* event unavailable */ }
|
|
475
|
+
|
|
476
|
+
return () => {
|
|
477
|
+
try { window.removeEventListener('keydown', onKeyDown, true) } catch { /* window unavailable */ }
|
|
478
|
+
try { document.removeEventListener('click', onDocumentClick, true) } catch { /* document unavailable */ }
|
|
479
|
+
if (guardTimer !== null) { clearInterval(guardTimer); guardTimer = null }
|
|
480
|
+
if (settingGuardTimer !== null) { clearInterval(settingGuardTimer); settingGuardTimer = null }
|
|
481
|
+
if (typeof offTheme === 'function') { try { offTheme() } catch { /* already off */ } }
|
|
482
|
+
for (const dispose of disposers) {
|
|
483
|
+
try { dispose() } catch { /* already disposed */ }
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}, 'gruvbox: themes')
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
490
|
+
name: 'settings.section',
|
|
491
|
+
id: 'gruvbox-theme',
|
|
492
|
+
order: 65,
|
|
493
|
+
label: () => t('title'),
|
|
494
|
+
}, () => h(GruvboxSettings, { t, getService: () => themeService })))
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return {
|
|
498
|
+
name: 'dsh-theme-gruvbox',
|
|
499
|
+
inject: ['slots', 'locale'],
|
|
500
|
+
apply,
|
|
501
|
+
}
|
|
502
|
+
},
|
|
503
|
+
})
|
package/cordis.patch.yml
ADDED
package/docs/DETAIL.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Gruvbox 主题
|
|
2
|
+
|
|
3
|
+
给 DeepSeek Harness 加一组 Gruvbox 暖色复古主题。Gruvbox 是 2012 年从 Vim 社区长出来的配色,底色偏暖,强调色是橙、黄、红、绿。
|
|
4
|
+
|
|
5
|
+
## 当前内容
|
|
6
|
+
|
|
7
|
+
暗色四档:
|
|
8
|
+
|
|
9
|
+
| 主题 id | 名称 | 背景 | 面板 | 侧栏 |
|
|
10
|
+
|---|---|---|---|---|
|
|
11
|
+
| `gruvbox-dark-hard` | Dark Hard | `#1d2021` | `#282828` | `#32302f` |
|
|
12
|
+
| `gruvbox-dark` | Dark Medium | `#282828` | `#32302f` | `#3c3836` |
|
|
13
|
+
| `gruvbox-dark-soft` | Dark Soft | `#32302f` | `#32302f` | `#3c3836` |
|
|
14
|
+
| `gruvbox-material-dark-soft` | Material Soft | `#32302f` | `#32302f` | `#3c3836` |
|
|
15
|
+
|
|
16
|
+
经典三档共用:
|
|
17
|
+
|
|
18
|
+
- 主文字 `#ebdbb2`,次文字 `#a89984`
|
|
19
|
+
- 品牌橙 `#fe8019`
|
|
20
|
+
- 错误 `#fb4934`、成功 `#b8bb26`、警告 `#fabd2f`、空闲 `#928374`
|
|
21
|
+
- 边框 `#504945` / `#665c54`
|
|
22
|
+
|
|
23
|
+
Material Soft:
|
|
24
|
+
|
|
25
|
+
- 主文字 `#ddc7a1`,次文字 `#bdae93`
|
|
26
|
+
- 品牌橙 `#e78a4e`
|
|
27
|
+
- 错误 `#ea6962`、成功 `#a9b665`、警告 `#d8a657`、空闲 `#928374`
|
|
28
|
+
- 边框 `#5a524c` / `#7c6f64`
|
|
29
|
+
|
|
30
|
+
## 组件底色
|
|
31
|
+
|
|
32
|
+
输入框和聊天框不覆盖,保持 DSH 默认;代码区、文件编辑卡片按当前档背景混黑,比背景深一档:
|
|
33
|
+
|
|
34
|
+
| 区域 | 规则 | Hard | Medium | Soft / Material |
|
|
35
|
+
|---|---|---|---|---|
|
|
36
|
+
| 输入框 / 聊天框 | DSH 默认 | `#2c2c2e` | `#2c2c2e` | `#2c2c2e` |
|
|
37
|
+
| 代码块 / 文件编辑卡片 | 背景 + 16% 黑 | `#181b1c` | `#222222` | `#2a2827` |
|
|
38
|
+
| 卡片悬停 | 背景 + 20% 黑 | `#171a1a` | `#202020` | `#282625` |
|
|
39
|
+
| 行内代码 | 背景 + 8% 黑 | `#1b1d1e` | `#252525` | `#2e2c2b` |
|
|
40
|
+
| 代码块标题栏 | 背景 + 14% 黑 | `#191c1c` | `#222222` | `#2b2928` |
|
|
41
|
+
|
|
42
|
+
代码块标题栏是代码块顶部的语言标签 / 复制按钮条;DSH 的代码块如果没渲染这一条,这个 token 不会有可见效果。
|
|
43
|
+
|
|
44
|
+
## 成本面板峰谷条
|
|
45
|
+
|
|
46
|
+
- 进度条:平价 `#a3d194`(Material `#9fc98f`),峰时 `#ff9800`;
|
|
47
|
+
- 细条 / 分段:峰段保持原生橙,平价段绿色;marker 是当前时间;
|
|
48
|
+
- 预算条不使用峰谷色,保持品牌橙。
|
|
49
|
+
|
|
50
|
+
## 安装与卸载
|
|
51
|
+
|
|
52
|
+
- 安装:在 DSH 插件管理器里把本目录作为 bundle 安装(`install_bundle`),然后刷新页面。
|
|
53
|
+
- 卸载:`remove_bundle`。源码目录、localStorage 里的选项会保留;插件不写 DSH 安装目录。
|
|
54
|
+
- 本地使用不需要打包;`npm pack` 或 zip 只用于分发和备份。
|
|
55
|
+
|
|
56
|
+
## 使用
|
|
57
|
+
|
|
58
|
+
设置 → Gruvbox 主题:
|
|
59
|
+
|
|
60
|
+
- 四张色卡切换主题;
|
|
61
|
+
- 「语法高亮」四个选项:跟随主题 / DSH 默认 / Gruvbox 经典 / Gruvbox Material;
|
|
62
|
+
- 「跟随内置主题」返回 DSH 自带的浅色、深色或跟随系统;
|
|
63
|
+
- 选择存在 `localStorage`(`dsh-theme-gruvbox:active`、`dsh-theme-gruvbox:syntax`),刷新后恢复。
|
|
64
|
+
|
|
65
|
+
## 语法高亮
|
|
66
|
+
|
|
67
|
+
覆盖 shiki 的 `--shiki-token-*` 变量:
|
|
68
|
+
|
|
69
|
+
| token | Gruvbox 经典 | Gruvbox Material |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| keyword | `#fb4934` | `#ea6962` |
|
|
72
|
+
| string / string-expression | `#b8bb26` | `#a9b665` |
|
|
73
|
+
| constant | `#d3869b` | `#d3869b` |
|
|
74
|
+
| parameter | `#fe8019` | `#e78a4e` |
|
|
75
|
+
| function | `#fabd2f` | `#d8a657` |
|
|
76
|
+
| punctuation | `#ebdbb2` | `#ddc7a1` |
|
|
77
|
+
| comment | `#928374` | `#7c6f64` |
|
|
78
|
+
| link | `#83a598` | `#7daea3` |
|
|
79
|
+
|
|
80
|
+
「跟随主题」按当前色档自动选经典或 Material;「DSH 默认」移除覆盖,代码块回到内置配色。
|
|
81
|
+
|
|
82
|
+
## 字体快捷键
|
|
83
|
+
|
|
84
|
+
Ctrl/Cmd + `+`、`=`、`-`、`_` 调整字体时,DSH 会把字体写入内置设置;第三方主题 id 不进入内置设置,主题可能被读回内置值。
|
|
85
|
+
|
|
86
|
+
插件在按键后 3 秒内每 150ms 检查一次,发现主题被覆盖就恢复存储的 Gruvbox 档,同时监听 `theme/change`。主动在「外观」里切内置主题(字体没变)不会被拉回。
|
|
87
|
+
|
|
88
|
+
## 实现
|
|
89
|
+
|
|
90
|
+
- 每个档注册一个 `ThemeDefinition`(`colorScheme: 'dark'`),只覆盖 alias token。
|
|
91
|
+
- `html[data-dsh-gruvbox]` 标记当前激活;`data-dsh-gruvbox-variant` 记录档位;`data-dsh-gruvbox-syntax` 控制语法高亮。
|
|
92
|
+
- 装饰只有 `color-scheme` 和选中文字色(`rgba(189,111,62,.55)` + `#fbf1c7`),没有动画、没有 `backdrop-filter`、没有 DOM 观察器。
|
|
93
|
+
- 主题切换是一次 CSS 变量重算,静态样式,不持续占资源。
|
|
94
|
+
- 终端选中色由 xterm 自绘,CSS 覆盖无效,保持 DSH 默认。
|
|
95
|
+
|
|
96
|
+
## 限制
|
|
97
|
+
|
|
98
|
+
- 第三方主题是进程内扩展,不进入 DSH 内置设置 schema,切换入口由插件自带。
|
|
99
|
+
- 只覆盖 alias 层和部分组件 token;个别组件内部颜色可能仍保持内置深色。
|
|
100
|
+
- 终端选中色没有统一(xterm 自绘)。
|
|
101
|
+
- 没有 light 档。曾做过 light soft / light hard,因为多处偏白已移除。
|
|
102
|
+
- 不改布局、字号、字体;这些仍走 DSH 设置。
|
|
103
|
+
|
|
104
|
+
## 版本与回退
|
|
105
|
+
|
|
106
|
+
插件目录有 git 仓库,关键节点:
|
|
107
|
+
|
|
108
|
+
| commit | 内容 |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `f3b1d8c` | 初始版(4 暗色档、语法选项、字体守卫) |
|
|
111
|
+
| `ada27bc` | 方案 3:输入框亮、代码块深 |
|
|
112
|
+
| `3a9f679` | Medium/Soft 加深 |
|
|
113
|
+
| `7226ec0` | 回到最初 A:组件走 DSH 默认 |
|
|
114
|
+
| `e2d3426` | 只提亮代码区 |
|
|
115
|
+
| `8d0427c` | 代码区加深 + 文件编辑卡片对齐 |
|
|
116
|
+
| `c597417` | 代码块 / 卡片最终加深到 84% |
|
|
117
|
+
| `3d7a0f9` | 设置页 / 面板 / 嵌套面加深一档 |
|
|
118
|
+
| `9395c13` | 思考中 / 轨迹 / 活动色统一为品牌橙 |
|
|
119
|
+
| `fac2fdc` | 成本面板平价段改绿,峰段保持橙 |
|
|
120
|
+
| `5880a15` | 粗体强制 700,配合鸿蒙黑体 |
|
|
121
|
+
|
|
122
|
+
要回退:在 `Work/dsh-theme-gruvbox` 里 `git checkout <commit> -- client.js`,然后重新安装 bundle。
|
|
123
|
+
|
|
124
|
+
## 文件
|
|
125
|
+
|
|
126
|
+
| 文件 | 作用 |
|
|
127
|
+
|---|---|
|
|
128
|
+
| `client.js` | 主题注册、设置页、语法选项、字体恢复、CSS |
|
|
129
|
+
| `index.js` | Host 空壳,仅为 bundle 安装 |
|
|
130
|
+
| `cordis.patch.yml` | bundle patch |
|
|
131
|
+
| `locale/*.json` | 插件详情页中英文案 |
|
|
132
|
+
| `icon.svg` | 插件图标 |
|
|
133
|
+
| `docs/DETAIL.md` | 本文档 |
|
package/docs/preview.png
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/icon.svg
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
|
|
2
|
+
<rect x="3" y="3" width="18" height="18" rx="4" fill="#fe8019"/>
|
|
3
|
+
<rect x="7" y="7" width="10" height="2" rx="1" fill="#1d2021"/>
|
|
4
|
+
<rect x="7" y="11" width="7" height="2" rx="1" fill="#1d2021"/>
|
|
5
|
+
<rect x="7" y="15" width="4" height="2" rx="1" fill="#282828"/>
|
|
6
|
+
</svg>
|
package/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host half of the Gruvbox theme bundle.
|
|
3
|
+
*
|
|
4
|
+
* The theme lives entirely in the browser half (`./client.js`), which registers
|
|
5
|
+
* ThemeDefinitions through the Client `theme` service and contributes a
|
|
6
|
+
* Settings section. The Host half only exists so the package can be installed
|
|
7
|
+
* as a normal bundle.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export function apply() {}
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-theme-gruvbox",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "Gruvbox warm retro themes for DeepSeek Harness: dark hard / medium / soft variants with a Settings switcher.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./client": "./client.js",
|
|
9
|
+
"./locale/*.json": "./locale/*.json",
|
|
10
|
+
"./icon": "./icon.svg"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js",
|
|
14
|
+
"client.js",
|
|
15
|
+
"cordis.patch.yml",
|
|
16
|
+
"locale/*.json",
|
|
17
|
+
"docs",
|
|
18
|
+
"icon.svg",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"dsh": {
|
|
22
|
+
"bundle": {
|
|
23
|
+
"patch": "./cordis.patch.yml"
|
|
24
|
+
},
|
|
25
|
+
"client": {
|
|
26
|
+
"platform": "web",
|
|
27
|
+
"inject": [
|
|
28
|
+
"@deepseek-ai/dsh-client-locale",
|
|
29
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
30
|
+
"@deepseek-ai/dsh-client-ui-theme"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"deepseek-harness",
|
|
36
|
+
"dsh",
|
|
37
|
+
"theme",
|
|
38
|
+
"gruvbox"
|
|
39
|
+
],
|
|
40
|
+
"license": "MIT"
|
|
41
|
+
}
|