DiffStyle
Details
- DiffStyleassoc can use the following keys to describe different elements of the diff result:
-
"Added" style for added elements "Changed" style for changed elements "Conflict" style for conflicts "NotChanged" style for elements that have not changed "Removed" style for removed elements - Color directives such as Red, as well as text specifications such as Bold or Small, can be given in place of options, just as in Style.
- Using DiffStyle<|keyspec|> is effectively equivalent to replacing the diff elements specified by key with Style[diffelement,spec].
- DiffStyle is applied after DefaultDiffStyle.
Examples
Basic Examples (3)
Increase the font size of added characters:
Diff["abc", "abcd", DiffStyle -> <|"Added" -> 24|>]Diff["abcdefg", "afg", DiffStyle -> <|"Removed" -> {Italic}|>]Customize styles in a unified diff:
Diff[{1, 2, 3}, {2, 3, 4}, "Unified", DiffStyle -> <|
"Added" -> {Background -> LightBlue, FontColor -> Purple},
"Removed" -> {Background -> LightOrange, FontColor -> Red},
"NotChanged" -> {Background -> Purple, FontColor -> White}|>]See Also
History
Text
Wolfram Research (2024), DiffStyle, Wolfram Language function, https://reference.wolfram.com/language/ref/DiffStyle.html.
CMS
Wolfram Language. 2024. "DiffStyle." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DiffStyle.html.
APA
Wolfram Language. (2024). DiffStyle. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiffStyle.html
BibTeX
@misc{reference.wolfram_2026_diffstyle, author="Wolfram Research", title="{DiffStyle}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/DiffStyle.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_diffstyle, organization={Wolfram Research}, title={DiffStyle}, year={2024}, url={https://reference.wolfram.com/language/ref/DiffStyle.html}, note=[Accessed: 12-June-2026]}