fix(ooxml): an xlsx fill shows its colour, and a font its toggles - #935
Merged
Merged
Conversation
This was referenced Sep 28, 2026
andiwand
force-pushed
the
docs/plan-cell-formatting
branch
from
September 28, 2026 18:21
1f273cf to
5fbc691
Compare
A pattern fill paints fgColor, but the reader took bgColor. So a solid fill showed the colour of the pattern background, which is often a different colour or the legacy slot 64. The reader now: - takes a solid fill from fgColor, and no fill from a pattern of none; - reads a theme colour from the a:clrScheme of the workbook, in the order lt1, dk1, lt2, dk2 of a theme index, and moves any colour by its tint; - reads i, u and strike in a font, and a val of 0 on b; - reads left and right horizontal alignment, and top and bottom. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXnz6EZY8YpyiyyE1GpsWy
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NXnz6EZY8YpyiyyE1GpsWy
The workbook found its theme by a target that starts with `theme/`. That misses a target from the package root, such as `/xl/theme/theme1.xml`. `parse_relationship_target` matches the relationship type and resolves both kinds of target. The test of the alignment now also reads vertical `top` and `bottom`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
andiwand
force-pushed
the
fix/xlsx-cell-style-read
branch
from
September 28, 2026 18:31
2f0eaa3 to
1eb3554
Compare
The xlsx theme and the pptx colour scheme read a slot the same way, so `read_drawing_rgb_color` in `ooxml_util` now does it for both. `apply_tint` moves next to it, because a docx or pptx colour transform can use it too. The changelog entry is shorter. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
html, pdf and ooxml each had their own copy of the sRGB transfer and of the conversion from a channel to a byte. The dark fill had Oklab, and the xlsx tint had HSL. `util/color_util` now holds all of them, and each module keeps only its own rule on top: `dark_fill`, `apply_tint`, and the pdf Lab and CMYK spaces. The formulas do not change, so the reference output stays the same. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tigcf9he3w1aHfNPJoEGsd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Generated with Claude Code
Step 1 of the cell-formatting plan: the xlsx reader reads what the writer will write.
Change
fgColor. The reader tookbgColor, so a solid fill showed the colour of the pattern background: cyan in place of#DEE6EFinmultiline.xlsx, for example. A pattern ofnone, or no pattern, now paints nothing.themecolour resolves from thea:clrSchemeof the theme that the workbook relates to by type, countedlt1,dk1,lt2,dk2,accent1… as SpreadsheetML counts them, andtintmoves the lightness of any colour ([ECMA-376] 18.8.19).i,uandstrike, andval="0"onbis not bold.leftandright, and vertical alignment readstopandbottom. Before, both readcenteronly.util/color_utilgathers the colour math that html, pdf and ooxml each had a copy of:to_byte(four copies), the sRGB transfer (two),Oklabfromhtml::dark_fillandHslfrom the xlsx tint. Each module keeps only its own rule on top. The xlsx theme and the pptx colour scheme shareooxml::read_drawing_rgb_color.Proof
OoxmlSpreadsheetStyletests on inlinestyles.xmland theme strings. The tint results are the values Excel shows: accent 1#4472C4"Darker 25%" is#2F5597, and "Lighter 80%" is#DAE3F3.ColorUtil,HslandOklabtests. The refactor leaves the full HTML output, public and private, byte-identical to the pinned reference output.multiline.xlsxnow match LibreOffice, andsample.xlsxshows its purple theme header and title, where the header was white text on white before.Reference output
8 public and 45 private files change, all xlsx. Both pins advance: public
f0cea38, private0ebf950.