How to get the system accent color for UWP-Apps?


Tags: css,windows-10,winjs,uwp,windows-10-mobile

Problem :

I'm trying to get the Accent Color of a user in a UWP-App for Windows 10. I know how to get it in C#, but I develop my apps in WinJS. So does anyone knows the WinJS equivalent for var color = (Color)Application.Current.Resources["SystemAccentColor"];?

It would also be nice, if I could Access this Color with CSS. I found some hints, that color: Highlight; would be the solution, but this gives me only a blue and not the Accent Color.

Thanks alot.



Solution :

you can use WinRT API to do that : Windows.UI.ViewManagement.UIColorType enumeration provides all accents colors. You can make something like :

var uiSettings = new Windows.UI.ViewManagement.UISettings();
var rgba = uiSettings.getColorValue(Windows.UI.ViewManagement.UIColorType.accent);
var cssColorString = "rgba(" + rgba.r + "," + rgba.g + "," + rgba.b + ", " + rgba.a + ")";

    CSS Howto..

    How to expand link on hoover? Add “<” “>” symbols around link?

    How To Display first 50 characters Of Text [closed]

    How to store a global variable in JQuery?

    How to write css for that?

    How can I get a Select elements Options to “right-width” but leave the width of the Select itself unchanged?

    how to create circle that cut off one piece with css

    How to have multiple CSS transitions on an element?

    how to hidden image over image in css

    CSS check box, how to make an item unchecked only if another one is checked

    how to use CSS opacity to let background bleed through in IE8?

    How do I remove the text underline (that I set myself) from a on hover?

    How to have an image zoom in and out automatically in the background

    how to use both fixed and relative position property in same page using css?

    How can I increase space just above the footer line?

    how to force page break between absolutely positioned elements in css

    What is SVG and how does it work?

    How to append the Pseudo-class (active) to

    How do I add a CSS class to a BoundField, so I can find it with jQuery?

    How to load a apply jQuery function upon appending a
    via Ajax?

    How page turn effect work in turn.js

    How do I target only elements that are followed by another (specific) element?

    How to add inset box-shadow to mapbox-div?

    How do I style DIVs inside a checkbox label based on if it is checked or not?

    How can I make one item with its own class a different colour from others?

    How to delete white space between two div element when they display as inline-block [duplicate]

    How is the “greater than” or “>” character used in CSS?

    How to put a border around the text in a button?

    Google Apps Script How to link to JS or CSS file on Google Drive

    How to change CSS element of data-pid using jquery

    How to exclude some text from browser zoom