Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d2cli: fix pptx using theme flags #2099

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@
- CLI: fixes edge case of watch mode links to nested board that had more nested boards not working [#2070](https://github.com/terrastruct/d2/pull/2070)
- CLI: fixes theme flag not being passed to GIF outputs [#2071](https://github.com/terrastruct/d2/pull/2071)
- CLI: fixes scale flag not being passed to animated SVG outputs [#2071](https://github.com/terrastruct/d2/pull/2071)
- CLI: pptx exports use theme flags correctly [#2099](https://github.com/terrastruct/d2/pull/2099)
12 changes: 8 additions & 4 deletions d2cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1048,10 +1048,14 @@ func renderPPTX(ctx context.Context, ms *xmain.State, presentation *pptx.Present
var err error

svg, err = d2svg.Render(diagram, &d2svg.RenderOpts{
Pad: opts.Pad,
Sketch: opts.Sketch,
Center: opts.Center,
Scale: scale,
Pad: opts.Pad,
Sketch: opts.Sketch,
Center: opts.Center,
Scale: scale,
ThemeID: opts.ThemeID,
DarkThemeID: opts.DarkThemeID,
ThemeOverrides: opts.ThemeOverrides,
DarkThemeOverrides: opts.DarkThemeOverrides,
})
if err != nil {
return nil, err
Expand Down
37 changes: 37 additions & 0 deletions e2etests-cli/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,43 @@ steps: {
assert.Success(t, err)
},
},
{
name: "pptx-theme-overrides",
skipCI: true,
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
writeFile(t, dir, "in.d2", `vars:{
d2-config: {
theme-overrides: {
# All red
N1: "#ff0000"
B1: "#ff0000"
B2: "#ff0000"
AA2: "#ff0000"
N2: "#ff0000"
N6: "#ff0000"
B4: "#ff0000"
B5: "#ff0000"
B3: "#ff0000"
N4: "#ff0000"
N5: "#ff0000"
AA4: "#ff0000"
AB4: "#ff0000"
B6: "#ff0000"
N7: "#ff0000"
AA5: "#ff0000"
AB5: "#ff0000"
}
}
}
a->z
a.b.c.d
`)
err := runTestMain(t, ctx, dir, env, "in.d2", "all_red.pptx")
assert.Success(t, err)
pptx := readFile(t, dir, "all_red.pptx")
testdataIgnoreDiff(t, ".pptx", pptx)
},
},
{
name: "one-layer-gif",
skipCI: true,
Expand Down
Binary file not shown.
Loading