In dark mode, the standard background color of View is pure black. While this does look nice on an iPhone X for example, it does cause “OLED smearing” when scrolling or doing other animations. Depending on the specific UI it can look really bad and obvious: scroll a list with the grouped list style where the cells have a different background color, and the cells seem to shrink while scrolling. This is really easily solved by using 050505 instead of pure black (see also https://medium.com/lookup-design/designing-a-dark-theme-for-oled-iphones-e13cdfea7ffe , andhttps://twitter.com/marcedwards/status/1053519077958803456?s=21 for a demonstration of what OLED smearing is).
Now, of course I could override the background color of every View in my app to use a custom color value. But that kinda sucks, is easy to forget, etc. So instead, how would one change the default color?
Edit: I know how to make custom colors, using the Asset Catalog or without, with different values for dark and light mode. That's not the problem. The question is specifically how to overwrite the default color.
I'm not certain if there is a way to override the default dark mode color, but you could configure a custom color set which has one color for light mode and then is a different color for dark mode. You would then just use this color set name throughout your app as you would any other color name. This doesn't solve your mentioning of needing to remember to use this color, but it may make it easier.
Example: I can use "BlackToWhite" as my color within my app, and anywhere I've done this, in light mode it will be black, and in dark mode it will be white
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.