Delen via


Changing the default windows phone 8 colors (override the chosen theme)

A couple of days ago I was trying to build an app over windows phone 8, My Apps theme had green as the main color and a light background. whenever the user changes the phone theme my app gets affected so if the user choose the foreground to be red all the controls highlight some of their borders and some of their states are going to be red while also if he changed the background to black my app bar color will change so it wont match my app theme and also some of the control properties will be overridden because of the changes in the setup. so in order to solve this problem I had to solutions the first was to override all the controls with a template or a style that matches my app design (this solution is hard and will take a lot of time and a lot of code) the second solution was to override the windows phone default theme and colors.

The following two links will help you a lot to understand the default colors more:

  1. https://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402557(v=vs.105).aspx
  2. https://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769552(v=vs.105).aspx

A good place to start is by copying one of the available themes either the dark or light one which ever matches your design more then make changes in it to match your design you can find these themes on your computer at the following link:

C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Design

Then add your new theme to your resources.

I found an easier way of doing that which is by using a library called Theme manager this library will enable you with one line to choose which theme to be used with your app and what accent color to be used or create a new one and it will be reflected in your app controls. The following is an example of how you can use it

ThemeManager.ToDarkTheme();

ThemeManager.SetAccentColor(new Color() { R = 214, G = 242, B = 185, A = 255 });

 

For more information on this package follow this link : https://www.jeff.wilcox.name/2012/01/phonethememanager/

Comments