Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(native_objects): disable negative inversion for point colors

hugohe3f265a6fce88a
diff --git a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py
index faececa0..e3fa8292 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/native_objects/chart_xml.py
@@ -291,9 +291,16 @@ def _chart_color(colors: list[str], index: int) -> str:
return _DEFAULT_CHART_COLORS[index % len(_DEFAULT_CHART_COLORS)]
-def _data_point_colors_xml(count: int, colors: list[str]) -> str:
+def _data_point_colors_xml(
+ count: int,
+ colors: list[str],
+ *,
+ disable_negative_invert: bool = False,
+) -> str:
+ invert_xml = '<c:invertIfNegative val="0"/>' if disable_negative_invert else ""
return "".join(
- f'<c:dPt><c:idx val="{idx}"/>{_series_color_xml(_chart_color(colors, idx))}</c:dPt>'
+ f'<c:dPt><c:idx val="{idx}"/>{invert_xml}'
+ f'{_series_color_xml(_chart_color(colors, idx))}</c:dPt>'
for idx in range(count)
)
@@ -352,6 +359,7 @@ def _series_xml(
point_colors_xml = _data_point_colors_xml(
len(item["values"]),
item["point_colors"],
+ disable_negative_invert=True,
)
if chart_type == "line":
marker_xml = _marker_xml("circle" if line_style == "lineMarker" else "none")