Computer Magic Logo
Change the application color scheme

Monday, April 11, 2016

Published by Aristotelis Pitaridis

Android, Windows and Windows Phone support different color schemes for the application. Let's see how to do it for the Android version of the application. We have to edit the AndroidManifest.xml file which is located in the Properties folder of the Android project. Initially this file has the following contents.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="15" />
    <application></application>
</manifest>

We add the following android:theme attribute to the application tag.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="15" />
    <application android:theme="@style/android:Theme.Holo.Light"></application>
</manifest>

Now the Android version of the application will display dark text and light background.

For the Windows and Windows Phone project we will have to change the App.xaml file which is located in the root folder of the windows and widows phone project. The App.xaml of the Windows phone application has the following form.

<Application
    x:Class="Sample.WinPhone.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Sample.WinPhone">

</Application>

We add the following RequestedTheme property to the Application element.

<Application
    x:Class="Sample.WinPhone.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Sample.WinPhone"
    RequestedTheme="Light">

</Application>