Skip to content

feat(converter): add theme color resolution and @page CSS support#87

Merged
JSv4 merged 1 commit intomainfrom
feature/theme-colors-and-page-css
Dec 21, 2025
Merged

feat(converter): add theme color resolution and @page CSS support#87
JSv4 merged 1 commit intomainfrom
feature/theme-colors-and-page-css

Conversation

@JSv4
Copy link
Copy Markdown
Owner

@JSv4 JSv4 commented Dec 21, 2025

Summary

  • Theme Color Resolution: Resolves w:themeColor attributes to actual RGB values from document theme
  • @page CSS Rule: Optional CSS @page rule generation for print stylesheets and PDF generation

Changes

Theme Color Resolution

  • New ResolveThemeColors setting (default: true) enables theme color resolution
  • Reads color scheme from theme1.xml (a:clrScheme element)
  • Supports all 12 theme colors: dk1, lt1, dk2, lt2, accent1-6, hlink, folHlink
  • Applies w:themeTint (lighten toward white) and w:themeShade (darken toward black) modifiers
  • Resolves w:themeColor in run colors, paragraph shading, cell shading, and fills
  • Falls back to explicit color value if theme color not found

@page CSS Rule

  • New GeneratePageCss setting (default: false) enables @page rule generation
  • Reads page dimensions from w:sectPr/w:pgSz and margins from w:sectPr/w:pgMar
  • Generates CSS @page { size: Xin Yin; margin: ... } rules
  • Supports US Letter, A4, and custom page sizes with proper inch conversions
  • Useful for print stylesheets and PDF generation

Test plan

  • Added 7 new unit tests for theme color and @page CSS functionality
  • All 1159 existing tests pass
  • Build succeeds with no new errors

Documentation

Theme Color Resolution:
- New ResolveThemeColors setting (default: true) enables theme color resolution
- Reads color scheme from theme1.xml (a:clrScheme element)
- Supports all 12 theme colors: dk1, lt1, dk2, lt2, accent1-6, hlink, folHlink
- Applies w:themeTint (lighten) and w:themeShade (darken) modifiers
- Resolves w:themeColor in run colors, paragraph shading, cell shading, and fills
- Falls back to explicit color value if theme color not found

@page CSS Rule:
- New GeneratePageCss setting (default: false) enables @page rule generation
- Reads page dimensions from w:sectPr/w:pgSz and margins from w:sectPr/w:pgMar
- Generates CSS @page { size: Xin Yin; margin: ... } rules
- Supports US Letter, A4, and custom page sizes with proper inch conversions

Tests:
- Added 7 new tests for theme color and @page CSS functionality

Addresses converter gaps #1 (No Page/Document Setup CSS) and #6 (Theme Colors Not Resolved)
@JSv4 JSv4 merged commit 9ef9664 into main Dec 21, 2025
6 checks passed
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