Devlog: May 31, 2023

I worked on dark mode a bit today. I’ve written about it a bit before, but my eyes have a really hard with pure black dark modes with black backgrounds and white text. This is the default in iOS. So I wanted to do something a little different.

For reference, here is light mode:

A screenshot of ScreenCred showing the app in light mode, with a white background and black bordersLight mode

And here is the default, pure black dark mode:

A screenshot of ScreenCred showing the app in dark mode, with a black background and white bordersOld dark mode

I decided to try replacing the black background with a dark gray. In this case, I used secondarySystemBackground. I also made the white borders thinner so they didn’t feel so heavy. I think since the images are darkish, the borders stand out a lot more than the black borders do in light mode.

A screenshot of ScreenCred showing the app in light mode, with a dark gray background and thin white bordersNew dark mode

I like this a lot better. Gonna try it more on my device to make sure.

To accomplish this, I removed the content background from my ScrollViews and added my own background based on the current colorScheme. Not too bad.

ScrollView {
    ...
}
.scrollContentBackground(.hidden)
.background(colorScheme == .dark ? Color(uiColor: .secondarySystemBackground) : Color(uiColor: .systemBackground))


Date
May 31, 2023