Skip to content

High contrast: disabled text uses the UISettings foreground instead of the disabled color when the platform has no system colors #26676

Backlog

Description

@morning4coffe-dev

Current behavior 🐛

When high contrast is on and the platform does not provide its own system colors, the text of a disabled control is drawn with UISettings foreground instead of the disabled (gray text) color. Depending on the scheme this is invisible text or the same color as enabled text.

UIElement.GetHighContrastTextColors() (src/Uno.UI/UI/Xaml/UIElement.HighContrast.cs) picks the text color for the high contrast adjustment. For a disabled element it looks up SystemColorDisabledTextColor, and falls back to UISettings.GetColorValue(UIColorType.Foreground) when that does not resolve. I measured the result with a runtime test (Uno.Sdk 7.1.0-dev.478, Skia desktop, macOS), using GetHighContrastTextColors() on a TextBlock in an enabled and in a disabled ContentControl:

Scheme Enabled text Disabled text Window color UISettings foreground
High Contrast Black #FFFFFFFF (correct) #FF000000 (black on black, invisible) #FF000000 #FF000000
High Contrast White #FF000000 #FF000000 (should be the gray text color, #FF6D6D6D) #FFFFFFFF #FF000000

In both schemes the disabled value is exactly UISettings foreground, so the SystemColorDisabledTextColor lookup returns the fallback. The enabled value (SystemColorWindowTextColor) resolves fine. The XAML system resources (Uno.UI/UI/Xaml/Style/Generic/SystemResources.xaml) define SystemColorGrayTextColor but no SystemColorDisabledTextColor. FrameworkTheming.RebuildColorAndBrushResources does list the key (set to the gray text value), but in my run it is not what the lookup finds.

This only happens on the path that has no HighContrastSystemColors: when the platform extension provides them (Win32, macOS and mobile with high contrast really on), colors.DisabledTextColor is used and the lookup is not reached. The extensions return null for example on X11 and when WinRTFeatureConfiguration.Accessibility.HighContrast is forced on a machine where high contrast is off, which is how I found it.

Expected behavior 🎯

Disabled text uses the disabled color of the scheme (SystemColorGrayTextColor: #FF3FF23F in High Contrast Black, #FF6D6D6D in High Contrast White), like the border of the same disabled controls does, and like colors.DisabledTextColor does on the other path.

How to reproduce it (as minimally and precisely as possible) 🔬

On Skia desktop, before showing any content (for example in OnLaunched):

Uno.WinRTFeatureConfiguration.Accessibility.HighContrast = true;
Uno.WinRTFeatureConfiguration.Accessibility.HighContrastScheme = "High Contrast Black"; // or "High Contrast White"

Page content:

<StackPanel Orientation="Horizontal" Spacing="16" Background="Black">
    <Button Content="Enabled button" />
    <Button Content="Disabled button" IsEnabled="False" />
    <ContentControl IsEnabled="False"><TextBlock Text="Disabled TextBlock" /></ContentControl>
    <TextBlock Text="Enabled TextBlock" />
</StackPanel>

High Contrast Black: the disabled button has a green border but no visible label, and the disabled TextBlock is not visible either.

High Contrast Black

High Contrast White: the disabled text is plain black, the same as the enabled text, instead of gray.

High Contrast White

(Both screenshots are the same page, rendered with RenderTargetBitmap.)

The UIElement.HighContrast.cs file is identical on master.

Workaround 🛠️

Set HighContrastAdjustment="None" on the element (or a parent). The control then uses its own brushes and the disabled button label is drawn in the gray text color (green in the black scheme). I checked this with the same page, with HighContrastAdjustment="None" on the StackPanel. A plain TextBlock is not disabled-aware, so it stays the normal text color.

Affected platforms 📱💻🖥️

Seen on Desktop (macOS) with the high contrast override. From the code, any platform that has no HighContrastSystemColors, for example Desktop (X11).

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk 7.1.0-dev.478

IDE version 🧑‍💻

Command line (dotnet build), no IDE.

Activity

  1. added
    triage/untriaged
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/untriaged

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions