Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Accent Color in Windows 10 UWP

Tags:

I dont really want to use the accent color that the user has chosen in Windows in my app, and instead want to have my own color show. I can change it manually on all the items by by making new styles, but it is just in so many places in the normal controls, that it would be nice to do on the app level.

I tried setting <SolidColorBrush x:Key="SystemAccentColor" Color="#FFCB2128" /> but for some reason that does noting on some items and turns others like the video controls gray.

like image 427
Kasper S Mathiesen Avatar asked Aug 05 '15 12:08

Kasper S Mathiesen


People also ask

How do I change the accent color?

Android system accent colors can be changed by going to Settings > Wallpaper & style > Basic colors and picking your favorite color. You can also go to Wallpaper colors to let Android pick the colors based on your wallpaper.


2 Answers

On Win10 UWP, System Accent color is defined as ThemeResource SystemControlHighlightAccentBrush. You can override it as following.

<ResourceDictionary.ThemeDictionaries>     <ResourceDictionary x:Key="Default">         <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Orange" />     </ResourceDictionary>     <ResourceDictionary x:Key="Dark">         <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Green" />     </ResourceDictionary>     <ResourceDictionary x:Key="Light">         <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="Blue" />     </ResourceDictionary> </ResourceDictionary.ThemeDictionaries> 
like image 131
Mamoru Satoh Avatar answered Oct 18 '22 05:10

Mamoru Satoh


To change accent color on every system control you have to redefine the system resource as follows.

Note that SystemAccentColor is a color, not a brush. If you don't redefine all other brushes, the color won't be applied on everything.

<ResourceDictionary.ThemeDictionaries>   <ResourceDictionary x:Key="Default">          <Color x:Key="SystemAccentColor">#FF20A060</Color>  <!--Your accent color-->      <SolidColorBrush x:Key="SystemControlBackgroundAccentBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="SystemControlDisabledAccentBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="SystemControlForegroundAccentBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="SystemControlHighlightAccentBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="SystemControlHighlightAltAccentBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="SystemControlHighlightAltListAccentHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9" />     <SolidColorBrush x:Key="SystemControlHighlightAltListAccentLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.6" />     <SolidColorBrush x:Key="SystemControlHighlightAltListAccentMediumBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.8" />     <SolidColorBrush x:Key="SystemControlHighlightListAccentHighBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.9" />     <SolidColorBrush x:Key="SystemControlHighlightListAccentLowBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.6" />     <SolidColorBrush x:Key="SystemControlHighlightListAccentMediumBrush" Color="{ThemeResource SystemAccentColor}" Opacity="0.8" />     <SolidColorBrush x:Key="SystemControlHyperlinkTextBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="ContentDialogBorderThemeBrush" Color="{ThemeResource SystemAccentColor}" />     <SolidColorBrush x:Key="JumpListDefaultEnabledBackground" Color="{ThemeResource SystemAccentColor}" />   </ResourceDictionary> </ResourceDictionary.ThemeDictionaries> 
like image 24
Tom Shane Avatar answered Oct 18 '22 04:10

Tom Shane