Skip to content

fix(table) :: show striped rows in dark mode - #1579

Merged
81reap merged 1 commit into
mainfrom
81reap/issue/957
Oct 30, 2026
Merged

81reap merged 1 commit into
mainfrom
81reap/issue/957

Conversation

@81reap

@81reap 81reap commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Tabler 1.5.0 didn't show table stripes in dark mode. This was fixed in Tabler 1.7.3 (tabler/tabler#3279). So we upgraded and added tests.

Fixes #957

Assisted-By :: Claude Opus 5.5

@81reap

81reap commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

repro from #957

$ cat tests/end-to-end/fixtures/repro_957/index.sql 
SELECT 'shell' AS component, 'dark' AS theme;
SELECT 'table' AS component, TRUE AS striped_rows;
SELECT 'x' AS value; SELECT 'x' AS value; SELECT 'x' AS value;

$ cat tests/end-to-end/fixtures/repro_957/light.sql 
SELECT 'shell' AS component, 'light' AS theme;
SELECT 'table' AS component, TRUE AS striped_rows;
SELECT 'x' AS value; SELECT 'x' AS value; SELECT 'x' AS value;

$ cat tests/end-to-end/fixtures/repro_957/test.ts 
import { expect, type Page, test } from "../../fixture.ts";

async function pixelColor(page: Page, x: number, y: number) {
  const png = await page.screenshot({ clip: { x, y, width: 1, height: 1 } });
  return page.evaluate(async (data) => {
    const image = new Image();
    image.src = `data:image/png;base64,${data}`;
    await image.decode();
    const canvas = document.createElement("canvas");
    canvas.width = 1;
    canvas.height = 1;
    const context = canvas.getContext("2d") as CanvasRenderingContext2D;
    context.drawImage(image, 0, 0);
    return [...context.getImageData(0, 0, 1, 1).data.slice(0, 3)];
  }, png.toString("base64"));
}

async function stripeContrast(page: Page) {
  const rows = page.locator("tbody tr");
  const backgrounds = [];
  for (const row of [rows.nth(0), rows.nth(1)]) {
    const box = await row.boundingBox();
    if (!box) throw new Error("row is not visible");
    backgrounds.push(await pixelColor(page, box.x + box.width - 3, box.y + box.height / 2));
  }
  const [odd, even] = backgrounds;
  return { odd, even, difference: Math.max(...odd.map((channel, i) => Math.abs(channel - even[i]))) };
}

test("striped rows are as visible in dark mode as in light mode", async ({ page }, testInfo) => {
  const dark = await stripeContrast(page);
  await testInfo.attach("dark", { body: await page.locator("table").screenshot(), contentType: "image/png" });

  await page.goto("/repro_957/light.sql");
  const light = await stripeContrast(page);
  await testInfo.attach("light", { body: await page.locator("table").screenshot(), contentType: "image/png" });

  console.log(`STRIPES dark ${JSON.stringify(dark)} light ${JSON.stringify(light)}`);
  expect(dark.difference).toBeGreaterThanOrEqual(light.difference / 2);
});
repro_957 postgres
v0.33.0 ✔ passed
v0.47.0 ✘ failed
tree ✔ passed

On commit 1f3db30a: nix run .#reproduce -- repro_957 postgres v0.33.0 v0.47.0 tree

@81reap
81reap force-pushed the 81reap/issue/957 branch 2 times, most recently from 5d3acb6 to c97f0af Compare October 30, 2026 00:35
@81reap
81reap marked this pull request as ready for review October 30, 2026 00:35
@lovasoa
lovasoa enabled auto-merge October 30, 2026 20:51
@lovasoa
lovasoa added this pull request to the merge queue Oct 30, 2026
@81reap
81reap removed this pull request from the merge queue due to a manual request Oct 30, 2026
Tabler 1.5.0 didn't show table stripes in dark mode. This was fixed in Tabler 1.7.3 (tabler/tabler#3279). So we upgraded and added tests.

Fixes #957

Assisted-By :: Claude Opus 5.5
@81reap
81reap enabled auto-merge October 30, 2026 21:11
@81reap
81reap added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 2d45bd4 Oct 30, 2026
21 checks passed
@81reap
81reap deleted the 81reap/issue/957 branch October 30, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

table component: TRUE AS striped_rows doesn’t apply when dark mode is enabled

2 participants