New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dark Mode: Add support for icons #290
Conversation
* This will allow us to tint them appropriately for dark mode
I'm loving this progress! If you're going to just do the whole thing, though, I think you should take your time and make it one big PR. You're making good progress but we should sweat the details, too. For example, some of the colors are off; the toolbar needs to be a lighter color than the stuff behind it, the search bar is an odd color, and the explorer screen looks really bright for dark mode (but maybe those last two are intentional on Apple's part?) I'll merge this whenever dark mode support is more or less complete :) |
Hey @NSExceptional! Are there specific concerns you have with the incremental approach? Benny and I synced on this work a few days ago and agreed the semantic layer was a good way to get things going without requiring everything to be done at once. With that layer, non-dark mode continues to work without any disturbance, and we can distribute the adoption work. Having gone through this once before in overhauling Instagram’s interface 3 years ago, I feel good about having incremental progress land on master. Definitely agree we should strive to get the details right, but I think we can make improvements here over time. Interested to hear your thoughts! |
Hey! Didn't realize you guys were collabing on this, haha. I'm just fond of doing this sort of thing in a feature-branch at the very least, so that someone using master directly doesn't end up with half-finished features, among other things. However, FLEX probably isn't mission-critical to any project out there (one would hope…) so if you guys wanna do this, go ahead I guess 😅 Out of curiosity, is there any reason you don't want this on a feature branch for the time being? |
Yea, for new features I would also avoid half-finished work landing on master. In this case, dark mode is already somewhat broken because vanilla Apple components display differently but any customizations do not. The changes here should generally be improvements and will only be evident if dark mode is turned on at the system level. By landing it on master, the improvements can be consumed immediately, the semantic color APIs can be used by any new feature work, and merge conflicts are avoided (common since many surfaces needed to be updated). |
Alrighty :P @ryanolsonk What do you think of this? I refactored Open this branch up in Xcode and launch it in the sim! https://github.com/NSExceptional/FLEX/tree/dark-mode There's a lot of hard-coded availability checks compared to the one in the #define FLEXDynamicColor(dynamic, static) { \
if (@available(iOS 13, *) { \
return [UIColor dynamic]; \
} else { \
return [UIColor static]; \
} \
}
+ (UIColor *)secondaryBackgroundColor {
return FLEXDynamicColor(secondarySystemBackgroundColor, lightGrayColor);
} |
Cool! I'll pull it down and give it a spin later tonight |
@NSExceptional sorry for the delay here! Checked out the branch and I'm into it! I think the one thing we need to preserve is the |
No worries! Gotcha, I'll take care of all that! I also noticed |
👍 just ran on iOS 12 and agree. Maybe we can pull out the values for the system colors so that we're mostly consistent independent of OS version. |
Yeah, currently updating the color explorer VC so I can just see the RGB / HSLA values right away so I can do just that 😄 |
I've been thinking about this:
Maybe we should revert |
The ifdef works well during the transitionary period. It allows work on dark mode while you’re preparing for the next iOS release but doesn’t get in the way of continuing to release with the public SDK. It’s unclear to me what value we get from reverting. |
Well, we wouldn't have to remove those checks later if we were to use a dedicated branch (so, no Could you tell me why you seem so against using a dedicated branch? 😅Surely it wouldn't be much trouble for anyone who needs dark mode right now to just switch to this branch in their Podfile or something (which would be just as much trouble as switching to I just see using separate branches as a cleaner way of dealing with these transitionary periods |
Sure, happy to explain the thinking. First, SDK compatibility is something we want to include regardless of when the code lands. Larger projects are often building simultaneously with multiple SDKs, and this can continue until well after the public release of the SDK. There's little downside to having the SDK compatibility checks, and it solves a clear problem. This is pretty common for framework code, and Nick Lockwood has a more extensive writeup here: https://gist.github.com/nicklockwood/d63c69ba2f40a33d7aa4 I found this site which seems to give a decent overview of the benefits of "trunk based development": https://trunkbaseddevelopment.com/ (disclaimer, I just did a quick scan and didn't review the material thoroughly). After living through several very painful long-lived branches at Flipboard, I have avoided the practice and strive to merge into master so long as things are not regressed and the changes make some improvement/forward progress. All of the major tech companies I'm familiar with follow this practice and avoid long-lived branching. It enables easier collaboration, avoids merge conflicts, and you don't have to constantly rebase to get the other development happening in the codebase. In the case of Benny's first dark mode changes, the view hierarchy debugger was initially in a bad/unusable state while dark mode was turned on. I was happy to get his changes on master to make things better for folks using FLEX while working on dark mode support. And as we continue to make improvements to FLEX under running in dark mode, I'm happy to get those changes out quickly to everyone also. |
Gotcha. That's not something I was aware of—that we want to guard SDK API availability with the preprocessor at all times, I mean. Are there not lots of APIs we're already making use of—added since iOS 8—without preprocessor guards? Do we want to add guards to those which currently only have runtime guards? |
👍 looks good! We're typically able to drop support for the building with the previous SDK around January, so having 12 as the min SDK at this point should be good. We previously had some compile gating around @available and the 11 SDK, but we can remove those now. |
Awesome! Unrelated: while we're here, how do we feel about grouping the globals list into sections? I've wanted to do this for a while now as I want to add a few things to the list as well (browse app or container instead of just container, NSProcessInfo, UIPasteboard, etc). Here's what it looks like. (Ignore the really dark nav bar, that's just beta Xcode not playing nice with Mojave) |
Yea! Looks like a nice improvement . |
* [DarkMode] Add comments and rearrange flex color header * [DarkMode] Load icons as templates * This will allow us to tint them appropriately for dark mode * [DarkMode] Add support for dark mode for the icons * [DarkMode] Add support for dark mode for hierarchy indent * [DarkMode] Add dark mode support for property editor
* [DarkMode] Add comments and rearrange flex color header * [DarkMode] Load icons as templates * This will allow us to tint them appropriately for dark mode * [DarkMode] Add support for dark mode for the icons * [DarkMode] Add support for dark mode for hierarchy indent * [DarkMode] Add dark mode support for property editor
In this PR, we add support for dark mode to the icons. It loads the icons as templates and uses tint color to support dark mode.
Also in this PR:
FLEXColor
Toolbar
Light:
Dark:
Hierarchy Indicator
Light:
Dark: