d2cli: fix pptx using theme flags

This commit is contained in:
Alexander Wang 2024-09-16 09:11:20 -06:00
parent 25e67cb3a6
commit 49cd8c47b5
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
3 changed files with 45 additions and 4 deletions

View file

@ -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

View file

@ -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,

Binary file not shown.