c# - Lightening the users accent colour -
for feature in app retrieve accent colour of user, lighten amount, give paler version of theme colour use within app.
does know how achieve this?
thanks.
place following in app.xaml.cs
private void setaccentresources() { var accent = (color)current.resources["phoneaccentcolor"]; var accent80 = accent; var accent60 = accent; var accent40 = accent; var accent20 = accent; accent80.a = (byte)(accent.a * 0.8); accent60.a = (byte)(accent.a * 0.6); accent40.a = (byte)(accent.a * 0.4); accent20.a = (byte)(accent.a * 0.2); resources.add("phoneaccentfullcolor", new solidcolorbrush(accent)); resources.add("phoneaccent80color", new solidcolorbrush(accent80)); resources.add("phoneaccent60color", new solidcolorbrush(accent60)); resources.add("phoneaccent40color", new solidcolorbrush(accent40)); resources.add("phoneaccent20color", new solidcolorbrush(accent20)); }
you can access like:
<control brush="{staticresource resourcekey=phoneaccent40color}" />
this adjusts alpha channel start show overlays. if want adjust color itself, adjust r, g, , b values.
Comments
Post a Comment