Inspect Alpha in WinUI Text Color Tokens
Admin ·
Copy a WinUI theme color according to where it will be used. Native XAML and CSS put alpha in different positions, and a partially transparent color takes on some of the background.
Composite TextFillColorPrimary on white
Select Light, search for TextFillColorPrimary and inspect Text Fill Color Primary. The XAML literal is #E4000000 and the CSS value is #000000E4. The last CSS byte E4 supplies the same alpha as the first XAML byte.
Enter #FFFFFF in Contrast background HEX. The preview reports effective text #1B1B1B on white. Change the input to #F3F3F3 to see #1A1A1A, then use the ratio on the screen to assess the actual pair.
Open Windows 11 ColorsMicrosoft XAML theme resourcesMicrosoft WinUI pinned theme resource sourceW3C guidance on text contrast
Trace the same text resource in Dark and Contrast theme
Switch Appearance to Dark. The selected text color becomes opaque white. Check it on the relevant dark surface before exporting any value for a mockup.
Switch to Contrast theme. The same brush points to SystemColorWindowTextColor. Use the theme resource in the native UI so that the person's contrast settings can resolve the value.
Microsoft XAML theme resourcesMicrosoft WinUI pinned theme resource source
Keep the Windows accent adaptive
Search for SystemAccentColor to find the live resource and the six light or dark variants. Check the accent brush entry when you want to see which variant WinUI uses in each appearance.
Choose Sample accents for fixed Fluent swatches you can use in a mockup. Export JSON if you need symbolic resources alongside the numeric color swatches. For an Acrylic or Mica layer, test the complete material against its surroundings on the device.
Microsoft Windows app theming and accentsMicrosoft XAML theme resourcesMicrosoft WinUI pinned theme resource sourceMicrosoft Fluent pinned sample accent swatches
Common questions
Does an eight-digit XAML color work unchanged in CSS?
Move alpha from the first byte to the last. An alpha of FF can be omitted from the CSS HEX form.
Why do the accent or contrast resources have no fixed HEX?
They resolve from Windows personalization or contrast settings. A fixed mockup can depict an example, while the native resource can adapt.