Skip to content

fix(core): paint automatic text white on a dark text box fill - #2153

Open
jamesashbourne-lawhive wants to merge 1 commit into
eigenpal:mainfrom
jamesashbourne-lawhive:fix/textbox-automatic-text-on-dark-fill
Open

jamesashbourne-lawhive wants to merge 1 commit into
eigenpal:mainfrom
jamesashbourne-lawhive:fix/textbox-automatic-text-on-dark-fill

Conversation

@jamesashbourne-lawhive

@jamesashbourne-lawhive jamesashbourne-lawhive commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Text with an automatic color has no w:color, or w:val="auto", anywhere in its style chain. Word picks white or black for it from the background behind the run. The editor already does this for run shading and paragraph shading, but not for a text box fill, so automatic text in a dark text box painted black.

We found this in a risk assessment form. Each section heading is a full-width text box with a dark red fill and bold heading text with no color. Word shows white headings. The editor showed black text on dark red, which is hard to read.

Behavior

  • Automatic text (w:color, CT_Color, ECMA-376 Part 1, §17.3.2.6) in a text box paints white when the box fill (a:solidFill, §20.1.8.54) is dark, and black when it is light or absent. The test is the same luma threshold that run and paragraph shading use (automaticTextColor).
  • The box decides from its own fill, not from shading around it. A white or unfilled text box inside a dark cell keeps black text. A Word reference document shows both as black.
  • A run with its own color keeps it.
  • Paragraph and cell shading (w:shd, §17.3.1.31 and §17.4.32) set automatic text white or black over the box. A light-shaded cell or paragraph inside a dark box stays black, and a dark-shaded cell takes white text, as Word shows it. Before, cell shading set no color, so automatic text in a dark cell painted black.
  • docx-fidelity.mdx states the rule under text and formatting.

Tests

  • textbox-automatic-text-color.test.ts adds 9 paint tests on inline-XML text boxes.
  • A dark fill paints automatic text white. It fails without the source change.
  • Light paragraph shading in a dark box paints black, and so does a light-shaded table cell in a dark box. A dark-shaded cell in a light box paints white. These fail without the semantic-paint.ts changes.
  • A white text box and an unfilled text box inside a dark-shaded cell paint black. These fail if the text box inherits the cell's color.
  • A light fill, and a run with its own color in a box or in a cell, pass before and after.
  • A Word reference document with a white cell in a dark text box, a dark body cell, and a white and an unfilled text box in a dark cell shows black, white, black and black text; the editor matches it with this change.
  • With the same change on 2.39.0, the form shows white headings in the editor.
  • typecheck, lint, format:check, check:docs, check:parity, check:lane-boundaries, check:license-headers, i18n:validate, reference:check-citations, collaboration:check, api:check (after build:packages), and openspec validate typed-ooxml-paragraph-editor --strict pass. test:changed ran 1517 files: 15695 tests pass.

Collaboration

collaboration:check asks for no decision. The change is in paint only. Shared state, operations, and synchronization are unchanged.


Run Proof on this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Text with an automatic color (w:color absent or auto, CT_Color, ECMA-376
Part 1, 17.3.2.6) takes its color from the background behind it. Run and
paragraph shading already turned it white on a dark fill, but a text box
fill (a:solidFill, 20.1.8.54) did not, so white headings on dark text
box bars painted black.

The text box content now paints automatic text white when the box fill
is dark and black otherwise, with the same luma threshold as shading.
Word decides it from the box's own fill, so a white or unfilled text box
inside a dark cell keeps black text. Paragraph and cell shading (w:shd,
17.3.1.31 and 17.4.32) set automatic text white or black over the box,
so a light cell inside a dark box stays readable, and a dark cell takes
white text as in Word.
@vercel

vercel Bot commented Nov 26, 2026

Copy link
Copy Markdown

@jamesashbourne-lawhive is attempting to deploy a commit to the EigenPal Team on Vercel.

A member of the Team first needs to authorize it.

@eigenpal-release-pal

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅

Posted by the CLA bot.

This branch has not been deployed

No deployments
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.

1 participant