uno
uno copied to clipboard
Support system accent color retrieval with UIColorType.Accent
What would you like to be added:
UISettings
class allows retrieval of UIColorType.Accent
and its darker and lighter versions. This can be supported on Android where system accent color can be set.
Why is this needed:
UWP parity.
Resources
- https://xamlbrewer.wordpress.com/2017/02/22/using-a-dynamic-system-accent-color-in-uwp/
For which Platform:
- [ ] iOS
- [x] Android
- [ ] WebAssembly
- [ ] WebAssembly renderers for Xamarin.Forms
- [ ] macOS
- [ ] Skia
- [ ] WPF
- [ ] GTK (Linux)
- [ ] Tizen
- [ ] Windows
- [ ] Build tasks
- [ ] Solution Templates
Gotchas:
- The accent color can potentially be anything (its "rules" are not clearly defined). We need to ensure that we don't use it as the "default accent" color, in case it would break accessibility (or adjust it by shifting the color to a safe range)
- It will require adding some color helpers for RGB -> HSL conversion, so the color brightness can be changed properly to scale to darker/lighter
Note that (according to UWP docs at least, I haven't tested) the base accent color can also be overridden by app code:
<Application.Resources>
<ResourceDictionary>
<Color x:Key="SystemAccentColor">#107C10</Color>
</ResourceDictionary>
</Application.Resources>
@davidjohnoliver we have that tracked in #3555 , that would be even more useful to support π (I think most apps override accent color anyway). However, even if overwritten in resources, UISettings
should still return the "system" color.
Browsers also support this feature now: https://github.com/w3c/csswg-drafts/issues/5187#issuecomment-800651916
Now supported in major browsers: https://twitter.com/una/status/1506383666548822020
β`accent-color` is now supported in all modern browsers ππ¨One line of code enables you to style previously-hard-to-access form controls like checkboxes and radio buttons
body { accent-color: hotpink; }
Works really nicely with the
color-scheme
property too! https://t.co/YRFQYyKQ2Gβ
@MartinZikmund: Uno currently only uses the default "windows" blue, and is ignoring the windows "accent-color", see #16608 Can this be fixed?