FontAutoColor Property

Returns the present calculated color of the text (black or white) to be used for 'auto color'. If the color is not 'auto' then returns Color.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Color AutoColor { get; }

Property Value

Type: Color
Remarks

When text has 'automatic color', the actual color of text is calculated automatically so that it is readable against the background color. As you change the background color, the text color will automatically switch to black or white in MS Word to maximize legibility.

Examples
Shows how calculated color of the text (black or white) to be used for 'auto color'
Run run = new Run(new Document());

// Remove direct color, so it can be calculated automatically with Font.AutoColor
run.Font.Color = Color.Empty;

// When we set black color for background, autocolor for font must be white
run.Font.Shading.BackgroundPatternColor = Color.Black;
Assert.AreEqual(Color.White, run.Font.AutoColor);

// When we set white color for background, autocolor for font must be black
run.Font.Shading.BackgroundPatternColor = Color.White;
Assert.AreEqual(Color.Black, run.Font.AutoColor);
See Also