Skip to content

Commit f4b2e7e

Browse files
zknprclaude
andcommitted
fix(theme): button text uses VS Code theme tokens for contrast (1.5.2)
Action buttons (Apply Changes, Add Row, Create Table, Export, Save, …) drew their label in hardcoded `color: white`, which could fall below a readable contrast on custom VS Code themes whose button/accent colors are light (#436). `.btn-primary` now uses `--vscode-button-background`/`-foreground` with `--vscode-button-hoverBackground` on hover; `.btn-secondary` uses the `--vscode-button-secondary*` tokens; `.btn-danger` keeps its error-colored background with `--vscode-button-foreground` text; and `.cell-preview-toolbar-btn.active` uses `--vscode-button-foreground`. Each token carries a fallback matching the previous appearance so the standalone web demo (rendered outside VS Code) is unchanged. Bumps the extension to 1.5.2 (changelog updated). Build regenerates the webview + web-demo bundles; 414/414 unit tests pass. Closes #436 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6cca038 commit f4b2e7e

5 files changed

Lines changed: 26 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.5.2
4+
5+
### Fixes
6+
7+
- **Button text now follows the active VS Code theme instead of a hardcoded white.** Action buttons (Apply Changes, Add Row, Create Table, Export, Save, …) drew their label in hardcoded white, which could fall below a readable contrast on custom themes whose button/accent colors are light. The primary, secondary, and danger buttons — and the active cell-preview toolbar toggle — now use the built-in VS Code button theme tokens (`--vscode-button-background` / `-foreground` / `-hoverBackground` and the `secondary*` variants), so text/background contrast is defined by the active theme. Fallback values matching the previous appearance are retained for the standalone web demo, which renders outside VS Code. Closes #436.
8+
39
## 1.5.1
410

511
### Fixes

core/ui/viewer.css

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -887,37 +887,46 @@ body {
887887
}
888888

889889
.btn-primary {
890-
background: var(--accent-color);
890+
/* VS Code button theme tokens: text/background contrast is defined by the
891+
active theme rather than hardcoded, so "Apply Changes" etc. stay legible
892+
on custom themes. Fallbacks mirror the Dark+ defaults and keep the
893+
standalone web demo (no --vscode-* vars) rendering unchanged. */
894+
background: var(--vscode-button-background, #0e639c);
891895
border: none;
892-
color: white;
896+
color: var(--vscode-button-foreground, #ffffff);
893897
padding: 6px 14px;
894898
border-radius: 3px;
895899
cursor: pointer;
896900
font-size: 13px;
897901
}
898902

899903
.btn-primary:hover {
900-
opacity: 0.9;
904+
/* Themed hover background replaces the previous opacity dim, which faded
905+
the button-foreground text and hurt contrast on some themes. */
906+
background: var(--vscode-button-hoverBackground, #1177bb);
901907
}
902908

903909
.btn-secondary {
904-
background: var(--bg-tertiary);
910+
background: var(--vscode-button-secondaryBackground, #3c3c3c);
905911
border: 1px solid var(--border-color);
906-
color: var(--text-primary);
912+
color: var(--vscode-button-secondaryForeground, #cccccc);
907913
padding: 6px 14px;
908914
border-radius: 3px;
909915
cursor: pointer;
910916
font-size: 13px;
911917
}
912918

913919
.btn-secondary:hover {
914-
background: var(--hover-bg);
920+
background: var(--vscode-button-secondaryHoverBackground, #2a2d2e);
915921
}
916922

917923
.btn-danger {
924+
/* No dedicated danger-button token exists; keep the error-colored
925+
background and use button-foreground (white in the standard themes) for
926+
readable text instead of a hardcoded white. */
918927
background: var(--error-color);
919928
border: none;
920-
color: white;
929+
color: var(--vscode-button-foreground, #ffffff);
921930
padding: 6px 14px;
922931
border-radius: 3px;
923932
cursor: pointer;
@@ -1073,7 +1082,7 @@ body {
10731082
.cell-preview-toolbar-btn.active {
10741083
background: var(--accent-color);
10751084
border-color: var(--accent-color);
1076-
color: white;
1085+
color: var(--vscode-button-foreground, #ffffff);
10771086
}
10781087

10791088
.cell-preview-footer {

0 commit comments

Comments
 (0)