Skip to content

High-contrast fallback for "Automatic" xlsx text colors #2988

@reagle

Description

@reagle

Problem: With options.xlsx_color_cells = True, VisiData honors a cell's explicit background fill but renders "Automatic" text color as the terminal default. When the fill and default have similar luminance (e.g., light-gray fill on a light terminal, or dark fill on a dark terminal), text becomes unreadable. Manually setting text to Black in Excel fixes contrast, confirming the issue is the "Automatic" pass-through.

Solution: When a cell has an explicit fill and "Automatic" text color, compute fill luminance and force black or white text accordingly. Alternatively, expose a fallback option (e.g., options.xlsx_auto_text_color) so users can set a default.

Repro:

  1. Create an .xlsx with cells that have an explicit light-gray background and "Automatic" text color.
  2. Open it in VisiData with a dark terminal theme and options.xlsx_color_cells = True.
  3. Observe that cell text is invisible.
Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions