Skip to content

BackgroundLayer does not render per-cell bgColor from CellStyle #7

@witqq

Description

@witqq

Problem

BackgroundLayer fills the entire canvas with a single theme.colors.background color. It does not read cellData.style.bgColor to render per-cell backgrounds.

Current behavior (v0.1.0 and v0.2.1)

rc.ctx.fillStyle = rc.theme.colors.background;
rc.ctx.fillRect(0, 0, rc.canvas.width, rc.canvas.height);

No per-cell background iteration exists in this layer.

Expected behavior

After the canvas-wide fill, BackgroundLayer should iterate visible cells and render individual backgrounds for cells that have style.bgColor defined:

// After canvas-wide fill:
for (const cell of visibleCells) {
  if (cell.style?.bgColor) {
    ctx.fillStyle = cell.style.bgColor;
    ctx.fillRect(cellX, cellY, cellW, cellH);
  }
}

Impact

Without per-cell background rendering, applications must implement custom layers that:

  1. Fill opaque white to erase engine text
  2. Apply the desired bgColor on top
  3. Re-render text with correct textColor

This creates triple rendering overhead and fragile workarounds.

Versions affected

  • @witqq/spreadsheet 0.1.0
  • @witqq/spreadsheet 0.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions