You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -50,9 +50,11 @@ If you have the WinUI 2 Gallery app installed, click <a href="winui2gallery:/ite
50
50
:::row-end:::
51
51
52
52
## Acrylic blend types
53
+
53
54
Acrylic's most noticeable characteristic is its transparency. There are two acrylic blend types that change what’s visible through the material:
54
-
-**Background acrylic** reveals the desktop wallpaper and other windows that are behind the currently active app, adding depth between application windows while celebrating the user’s personalization preferences.
55
-
-**In-app acrylic** adds a sense of depth within the app frame, providing both focus and hierarchy.
55
+
56
+
-**Background acrylic** reveals the desktop wallpaper and other windows that are behind the currently active app, adding depth between application windows while celebrating the user’s personalization preferences.
57
+
-**In-app acrylic** adds a sense of depth within the app frame, providing both focus and hierarchy.
@@ -77,30 +79,34 @@ For vertical panes or surfaces that help section off content of your app, we rec
77
79
78
80
For apps with context menus, flyouts, non-modal popups, or light-dismiss panes, it is recommended to use background acrylic, especially if these surfaces draw outside the frame of the main app window.
79
81
80
-

82
+

81
83
82
84
Many XAML controls draw acrylic by default. [MenuFlyout](../controls/menus.md), [AutoSuggestBox](../controls/auto-suggest-box.md), [ComboBox](/uwp/api/windows.ui.xaml.controls.combobox), and similar controls with light-dismiss popups all use acrylic while open.
83
85
84
-
> [!Note]
86
+
> [!NOTE]
85
87
> Rendering acrylic surfaces is GPU-intensive, which can increase device power consumption and shorten battery life. Acrylic effects are automatically disabled when a device enters Battery Saver mode. Users can disable acrylic effects for all apps by turning off _Transparency effects_ in Settings > Personalization > Colors.
86
88
87
89
## Usability and adaptability
90
+
88
91
Acrylic automatically adapts its appearance for a wide variety of devices and contexts.
89
92
90
93
In High Contrast mode, users continue to see the familiar background color of their choosing in place of acrylic. In addition, both background acrylic and in-app acrylic appear as a solid color:
91
-
- When the user turns off _Transparency effects_ in Settings > Personalization > Colors.
92
-
- When Battery Saver mode is activated.
93
-
- When the app runs on low-end hardware.
94
+
95
+
- When the user turns off _Transparency effects_ in Settings > Personalization > Colors.
96
+
- When Battery Saver mode is activated.
97
+
- When the app runs on low-end hardware.
94
98
95
99
In addition, only background acrylic will replace its translucency and texture with a solid color:
96
-
- When an app window on desktop deactivates.
97
-
- When the app is running on Xbox, HoloLens, or in tablet mode.
100
+
101
+
- When an app window on desktop deactivates.
102
+
- When the app is running on Xbox, HoloLens, or in tablet mode.
98
103
99
104
### Legibility considerations
100
105
101
106
It’s important to ensure that any text your app presents to users meets contrast ratios (see [Accessible text requirements](../accessibility/accessible-text-requirements.md)). We’ve optimized the acrylic resources such that text meets contrast ratios on top of acrylic. We don't recommend placing accent-colored text on your acrylic surfaces because these combinations are likely to not pass minimum contrast ratio requirements at the default 14px font size. Try to avoid placing [hyperlinks](../controls/hyperlinks.md) over acrylic elements. Also, if you choose to customize the acrylic tint color or opacity level, keep the impact on legibility in mind.
102
107
103
108
## Acrylic theme resources
109
+
104
110
You can easily apply acrylic to your app’s surfaces using the XAML [AcrylicBrush](/windows/winui/api/microsoft.ui.xaml.media.acrylicbrush) or predefined AcrylicBrush theme resources. First, you’ll need to decide whether to use in-app or background acrylic. Be sure to review common app patterns described earlier in this article for recommendations.
105
111
106
112
We’ve created a collection of brush theme resources for both background and in-app acrylic types that respect the app’s theme and fall back to solid colors as needed. For WinUI 2, these theme resources are located in the [AcrylicBrush themeresources file, in the microsoft-ui-xaml GitHub repo](https://github.com/microsoft/microsoft-ui-xaml/blob/6aed8d97fdecfe9b19d70c36bd1dacd9c6add7c1/dev/Materials/Acrylic/AcrylicBrush_19h1_themeresources.xaml#L11). Resources that include *Background* in their names represent background acrylic, while *InApp* refers to in-app acrylic.
@@ -112,12 +118,14 @@ To paint a specific surface, apply one of the WinUI 2 theme resources to element
112
118
```
113
119
114
120
## Custom acrylic brush
121
+
115
122
You may choose to add a color tint to your app’s acrylic to show branding or provide visual balance with other elements on the page. To show color rather than greyscale, you’ll need to define your own acrylic brushes using the following properties.
116
-
-**TintColor**: the color/tint overlay layer.
117
-
-**TintOpacity**: the opacity of the tint layer.
118
-
-**TintLuminosityOpacity**: controls the amount of saturation that is allowed through the acrylic surface from the background.
119
-
-**BackgroundSource**: the flag to specify whether you want background or in-app acrylic.
120
-
-**FallbackColor**: the solid color that replaces acrylic in Battery Saver. For background acrylic, fallback color also replaces acrylic when your app isn’t in the active desktop window or when the app is running on phone and Xbox.
123
+
124
+
-**TintColor**: the color/tint overlay layer.
125
+
-**TintOpacity**: the opacity of the tint layer.
126
+
-**TintLuminosityOpacity**: controls the amount of saturation that is allowed through the acrylic surface from the background.
127
+
-**BackgroundSource**: the flag to specify whether you want background or in-app acrylic.
128
+
-**FallbackColor**: the solid color that replaces acrylic in Battery Saver. For background acrylic, fallback color also replaces acrylic when your app isn’t in the active desktop window or when the app is running on phone and Xbox.
@@ -127,7 +135,7 @@ You may choose to add a color tint to your app’s acrylic to show branding or p
127
135
128
136
To add an acrylic brush, define the three resources for dark, light and high contrast themes. Note that in high contrast, we recommend using a SolidColorBrush with the same x:Key as the dark/light AcrylicBrush.
129
137
130
-
> [!Note]
138
+
> [!NOTE]
131
139
> If you don't specify a TintLuminosityOpacity value, the system will automatically adjust its value based on your TintColor and TintOpacity.
In addition, you'll need to draw your app's title, which normally appears automatically in the title bar, with a TextBlock using `CaptionTextBlockStyle`. For more info, see [Title bar customization](../../develop/title-bar.md).
241
249
242
250
## Do's and don'ts
251
+
243
252
* Do use acrylic on transient surfaces.
244
253
* Do extend acrylic to at least one edge of your app to provide a seamless experience by subtly blending with the app’s surroundings.
245
254
* Don't put desktop acrylic on large background surfaces of your app.
0 commit comments