Set Shape Color Independently of Font Color

GroupDocs.Comparison for Python via .NET lets you colour shapes separately from text. Use StyleSettings.shape_color alongside font_color to emphasize shape modifications without altering text colour coding.

Example: Different colours for shapes and fonts

from groupdocs.comparison import Comparer
from groupdocs.comparison import Color
from groupdocs.comparison.options import CompareOptions, StyleSettings


def set_shape_color_independently():
    options = CompareOptions()
    options.detect_style_changes = True
    options.mark_changed_content = True

    inserted = StyleSettings()
    inserted.font_color = Color.from_name("blue")
    inserted.shape_color = Color.from_name("purple")
    options.inserted_item_style = inserted

    deleted = StyleSettings()
    deleted.font_color = Color.from_name("red")
    deleted.shape_color = Color.from_name("orange")
    options.deleted_item_style = deleted

    changed = StyleSettings()
    changed.font_color = Color.from_name("green")
    changed.shape_color = Color.from_name("lightgreen")
    options.changed_item_style = changed

    with Comparer("./source.docx") as comparer:
        comparer.add("./target.docx")
        comparer.compare("./result.docx", options)

if __name__ == "__main__":
    set_shape_color_independently()

source.docx is the source file used in this example. Click here to download it.

target.docx is the target file used in this example. Click here to download it.

Binary file (DOCX, 25 KB)

Download full output

Use case: emphasize shape modifications (e.g., diagrams) without altering text colour coding.

The result is as follows:

When the distinction matters

StyleSettings.font_color controls the colour of text runs in the result. StyleSettings.shape_color controls the colour of shape outlines and fills — text frames, callouts, lines, autoshapes, diagram elements.

In documents that mix prose and diagrams (technical specs, contracts with embedded org charts, marketing decks with infographics), using a single colour for both makes shape changes hard to spot against the text-change highlights. Setting shape_color distinct from font_color gives you a visually obvious “this shape was modified” signal.

When the source/target only differ in text, set font_color only and skip shape_color — leaving it at the default keeps shapes visually neutral.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.