Skip to content

d2lib: preserve theme override precedence - #2832

Merged
alixander merged 1 commit into
masterfrom
agent/fix-theme-override-precedence
Aug 10, 2026
Merged

d2lib: preserve theme override precedence#2832
alixander merged 1 commit into
masterfrom
agent/fix-theme-override-precedence

Conversation

@alixander

Copy link
Copy Markdown
Collaborator

What changed

Apply source-defined light and dark theme overrides only when the caller did not already provide the corresponding render option.

Why

applyConfigs documents that caller-supplied options take precedence and follows that rule for layout, theme IDs, sketch, padding, and centering. Theme override objects were the exception: they were assigned unconditionally, so source configuration silently replaced public Go API options.

Validation

  • Added focused tests proving caller precedence and config fallback for both light and dark overrides
  • go test ./d2lib -count=1
  • go test -race ./d2lib -run '^TestApplyConfigsThemeOverridePrecedence$' -count=1
  • go test ./e2etests -run '^TestE2E$' -count=1 -parallel=1
  • git diff --check

@alixander
alixander force-pushed the agent/fix-theme-override-precedence branch 5 times, most recently from 88f47ed to 2a78c0f Compare August 10, 2026 01:28
Signed-off-by: Alexander Wang <alex@terrastruct.com>
@alixander
alixander force-pushed the agent/fix-theme-override-precedence branch from 2a78c0f to 5639a66 Compare August 10, 2026 01:28
@alixander
alixander marked this pull request as ready for review August 10, 2026 01:33
@alixander
alixander merged commit f636ff9 into master Aug 10, 2026
6 checks passed
@alixander
alixander deleted the agent/fix-theme-override-precedence branch August 10, 2026 01:33
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