Skip to content

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

Closed

Description

@lovasoa

Hello, I was testing the TRUE AS striped_rows parameter, but it seems that it doesn’t apply row coloring when dark mode is enabled.
link
Screenshot 2025-07-09 at 11 14 36

Originally posted by @amrutadotorg in #956 (comment)

Activity

  1. 81reap commented on Oct 29, 2026

    @81reap
    Collaborator

    I think this is still an issue

    Reproduction

    $ 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/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 ✘ failed

    On commit 616df27: nix run .#reproduce -- repro_957 postgres v0.33.0 v0.47.0 tree

  2. added 3 commits that reference this issue on Oct 30, 2026
    5d3acb6
    c97f0af
    7498072
  3. added a commit that references this issue on Oct 31, 2026
    2d45bd4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions