Description
When highlight annotations or sticky note annotations are made to a FlowDocument, the highlight (and anchor) use hard coded colors. This behavior is undesirable as it can lead to accessibility problems when using custom themes.
The sticky note highlight annotation uses hard coded colors defined here:
internal static Color DefaultAnchorBackground = (Color)ColorConverter.ConvertFromString("#3380FF80");
internal static Color DefaultMarkerColor = (Color)ColorConverter.ConvertFromString("#FF008000");
internal static Color DefaultActiveAnchorBackground = (Color)ColorConverter.ConvertFromString("#3300FF00");
internal static Color DefaultActiveMarkerColor = (Color)ColorConverter.ConvertFromString("#FF008000");
The highlight annotation uses hard coded colors defined here:
private Color _defaultBackroundColor = (Color)ColorConverter.ConvertFromString("#33FFFF00");
private Color _defaultActiveBackgroundColor = (Color)ColorConverter.ConvertFromString("#339ACD32");
It ought to be possible to set these colors from the controls which support annotations i.e. FlowDocumentReader and FlowDocumentScrollViewer which derive from DocumentViewerBase.
Currently the only way to alter the highlight color is to manually modify the AnnotationResource objects in the Annotation.Cargos each time an annotation is loaded or when the application or system theme changes. The anchor colors can only be set via reflection.