12

In windows 8 consumer preview you can personalize your experience, including setting a 'background color' which is then also used as the background for selected tiles, app bar etc. So selecting orange will mean that orange accents are visible in the Windows 8 Metro UI.

I am currently authoring some custom controls, and I would like to have access to this color in my styling, so as the user changes color so my applications accents are re-colored accordingly.

I cannot find a way of getting at this color in my XAML. It seems reasonable to expect that there is a system-level dynamic brush or color resource that you could reference.

Does anyone have any ideas ?

Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
Dean Chalk
  • 20,076
  • 6
  • 59
  • 90

3 Answers3

7

Based on this thread (Start Screen background as my metro apps background) on MSDN - this is not available.

In case the MSDN thread disappears, the site is temporarily unavailable, or Microsoft moves the directory structure around and leaves orphaned links all over the place: The relevant answer there, from Microsoft employee Rob Kaplan, said:

Metro style apps cannot query the start screen background color.

So it can be construed as an official response that this functionality is unavailable.

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
  • 1
    +1. Unfortunate, given WP7 allows you to get the users accent color. – Alan Apr 10 '12 at 23:13
  • 1
    I think for most applications it is probably better to define themes independently from the OS anyway. It is easier for once - you don't have to worry about your app design supporting multiple themes which involves checking what the theme is and providing assets that match each of these themes. Imagine you need to provide icons or backgrounds that play well with all possible themes and perhaps future themes that are not available for testing yet. Also - it is probably better for branding your application. Then perhaps Microsoft does not want people to think your app is part of the OS... – Filip Skakun Apr 11 '12 at 15:25
  • And still not [available in Windows 8.1 "Sorry, this is not an accessible color from the UI frameworks.", per Tim Heuer, Program Manager, UI Platforms](http://social.msdn.microsoft.com/Forums/en-US/9a200123-45cd-4f14-8ab7-f997e0534495/using-windows-accent-color?forum=w81prevwCsharp) – Rowland Shaw Jun 13 '14 at 08:38
  • This is accessible in Windows 10 – Jerry Nixon Sep 25 '15 at 23:16
5

Alan,

While I would agree with you that the "branding" concept makes good sense if you are planning on complex graphic overlays, getting the base theme color as is available on the Windows Phone using a static theme brush provided by the OS is a better choice for base color themes in your app. The user has chosen that color because they find it pleasing to the eye. Even more important, certain users may be color blind to one or more colors and have chosen the best option to enhance readability and accessibility.

Having access to the standard color scheme allows you to stay within the light/dark theme and meet the accessibility standards required by many corporations for all programs for those that are visually impaired.

The SDK is in it's infancy and it is possible that this important feature has been left out of the current implementation because it was not ready for the release of the SDK (colors might not have been finalized or compatibility of the theme on certain devices was still being developed).

It isn't too difficult to derive the theme color from an existing theme brush that is given to you such as ProgressBarForegroundThemeBrush by adding/subtracting values to get the current theme color.

My suggestion would be to adhere to the theme styles as best as possible to ensure your application will remain current regardless of changes to the operating system.

I have been a Windows Phone programmer since May 2010.

Thomas Mullen
  • 101
  • 1
  • 2
2

There are some undocumented APIs in UxTheme.dll that retrieve theme colours. If you use these functions and submit your app to the Windows Store it will fail certification, and in general it's a bad idea to rely on undocumented functions anyway. Still, for those interested in getting these values, I wrote about the process.

svick
  • 236,525
  • 50
  • 385
  • 514
Quppa
  • 1,841
  • 20
  • 18
  • Further to this, I made a [reference table](http://www.quppa.net/win8col/) of the theme colours found in Windows 8. – Quppa Jan 01 '13 at 17:10