Skip to content

Highlight annotations and sticky note annotations on FlowDocument use hard coded colors #1517

Open
@elyoh

Description

@elyoh

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.

sticky note annotation issue

The sticky note highlight annotation uses hard coded colors defined here:

MarkedHighlightComponent.cs

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:

HighlightComponent.cs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AccessibilityAn issue related to accessibility enhancements or blockers.BugProduct bug (most likely)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions