Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions rust/perspective-viewer/src/themes/gruvbox.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ perspective-viewer [theme="Gruvbox Light"] {
--psp-status-icon--initializing--color: var(--theme-yellow);
--psp-status-icon--psp-error--color: var(--theme-red);

--psp-code-editor--symbol--color: var(--theme-fg0);
--psp-code-editor--literal--color: var(--theme-alt-blue);
--psp-code-editor--operator--color: var(--theme-alt-green);
--psp-code-editor--comment--color: var(--theme-gray);
--psp-code-editor--column--color: var(--theme-alt-purple);

/* perspective-viewer-gruvbox-light--datagrid */
--psp-datagrid--pos-cell--color: var(--theme-blue);
--psp-datagrid--neg-cell--color: var(--theme-red);
Expand Down
6 changes: 6 additions & 0 deletions rust/perspective-viewer/src/themes/solarized-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ perspective-viewer [theme="Solarized Dark"] {
--psp-inactive--border-color: var(--psp-inactive--color);
--psp--background-color: #073642;

--psp-code-editor--symbol--color: #93a1a1;
--psp-code-editor--literal--color: #268bd2;
--psp-code-editor--operator--color: #859900;
--psp-code-editor--comment--color: #657b83;
--psp-code-editor--column--color: #2aa198;

/* perspective-viewer-solarized-dark--webgl */
--psp-charts--treemap--labels: white;
--psp-charts--treemap--hover-highlight: white;
Expand Down
6 changes: 6 additions & 0 deletions rust/perspective-viewer/src/themes/solarized.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ perspective-viewer [theme="Solarized"] {
--psp-column-type--date--color: #2aa198;
--psp-column-type--boolean--color: #b58900;

--psp-code-editor--symbol--color: #586e75;
--psp-code-editor--literal--color: #268bd2;
--psp-code-editor--operator--color: #859900;
--psp-code-editor--comment--color: #93a1a1;
--psp-code-editor--column--color: #6c71c4;

/* perspective-viewer-solarized--datagrid */
--psp-datagrid--pos-cell--color: #268bd2 !important;
--psp-datagrid--neg-cell--color: #cb4b16 !important;
Expand Down
71 changes: 71 additions & 0 deletions rust/perspective-viewer/test/js/settings_panel/debug_panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,75 @@ test.describe("DebugPanel validation", () => {
"State",
]);
});

test("all themes define non-transparent code editor syntax colors in the debug panel", async ({
page,
}) => {
await page.evaluate(async () => {
await new Promise((resolve, reject) => {
const link = document.createElement("link");
link.rel = "stylesheet";
link.href =
"/node_modules/@perspective-dev/viewer/dist/css/themes.css";
link.onload = resolve;
link.onerror = reject;
document.head.appendChild(link);
});

const viewer = document.querySelector("perspective-viewer")! as any;
await viewer.resetThemes();
});

const themes: string[] = await page.evaluate(async () => {
const viewer = document.querySelector("perspective-viewer")! as any;
return await viewer.getThemes();
});

expect(themes).toContain("Solarized");
expect(themes).toContain("Solarized Dark");
expect(themes).toContain("Gruvbox Light");

for (const theme of ["Solarized", "Solarized Dark", "Gruvbox Light"]) {
const colors = await page.evaluate(async (themeName) => {
const viewer = document.querySelector(
"perspective-viewer",
)! as any;
await viewer.restore({ theme: themeName });
const editor = viewer.shadowRoot!.querySelector(
"#debug-panel-editor #editor",
)!;
const style = window.getComputedStyle(editor);
return {
symbol: style
.getPropertyValue("--psp-code-editor--symbol--color")
.trim(),
literal: style
.getPropertyValue("--psp-code-editor--literal--color")
.trim(),
operator: style
.getPropertyValue("--psp-code-editor--operator--color")
.trim(),
comment: style
.getPropertyValue("--psp-code-editor--comment--color")
.trim(),
column: style
.getPropertyValue("--psp-code-editor--column--color")
.trim(),
};
}, theme);

for (const [key, value] of Object.entries(colors)) {
expect(value, `${theme} missing valid ${key} color`).not.toBe(
"",
);
expect(value, `${theme} has transparent ${key} color`).not.toBe(
"transparent",
);
expect(
value,
`${theme} has transparent rgba ${key} color`,
).not.toBe("rgba(0, 0, 0, 0)");
}
}
});
});