Dark Mode - Button and font colors - swift

Currently I have a button that changes the background color of my app (my users complained that it melted into other windows when grey, but others wanted that color scheme). I have 3 color options: grey with black text, light blue with blue text, and purple with white text.
Problem 1:
Dark mode is messing with my color scheme - can I set something up to adjust based on if they have dark mode on? Otherwise, I'm going to have to end up with grey text with a grey background in order for it to be ok when it switches back to grey.
Problem 2:
Button text - this wasn't so bad when using light mode because the buttons didn't change color, but on dark mode, this gets hard to read the button. White text on a light blue background hurts my eyes
I'm unable to attach images due to my level
I'm using Xcode 11.5, swift 5, and I'm coding for a Mac Application

Sounds like you are using the system color for the text / background color. And in dark mode, IOS will automatically change the system color for different mode. For reference:
https://developer.apple.com/design/human-interface-guidelines/ios/visual-design/color/#dynamic-system-colors
Indeed for both problem 1&2, if you want to use custom color (not the system one) for each mode, you can put your color sets into an asset file (and I would suggest adding a new one, rather than adding all color together with your image). For each set of color, set them to the desired appearance (any, light, dark), then set the color by code.
Apple give a detail documentation about that:
https://developer.apple.com/documentation/xcode/supporting_dark_mode_in_your_interface

Related

How to change modal background in react-native-picker-select?

I want to try changing the background color of modal from white to black. that's because I'm implementing the dark mode and light mode features

How to Match NSVisualEffectView Color to Window

I am working on a Swift 4 macOS Application that involves a vibrant dark window and an in-window NSVisualEffectView. Currently, the NSVisualEffectView's color does not quite match that of the window, but it is very close.
How can I make the NSVisualEffectView's color perfectly match the window? My goal is to have the blur effect it provides only appear when content is beneath it, and making it's color match that of the window would create this effect. I have included an image of what is currently happening. You may need to zoom into the image and turn up your display brightness to see the difference. Though it appears minor in this screenshot, the NSVisualEffectView spans the entire window, and on the Retina display of a Mac, the difference is apparent.
I have tried setting the NSVisualEffectView's background color to clear, but that has not worked.
visualEffectView.wantsLayer = true
visualEffectView.layer?.backgroundColor = NSColor.clear.cgColor
I would appreciate any advice on this!

Xcode Text View detection color

I have a TextView using white text so it shows up against the dark background image I am using. I want to keep a background image behind this text.The TextView is correctly responding and phone number on it shows as blue which is hard to see against the background. Is there a way to change the color of these detected phone numbers, links etc?

Figuring out the text color based on background view color iOS

I have these Views on which I add UILabels as text, The Views can have a background color that is dynamic and cannot be chosen,
Based on that I need to figure out the font color from only a set of three choices - two black or white or dark grey.
For example on a dark red background, a white font would be more suitable than black, while on a light yellow, perhaps a dark grey or black would be readable,
is there any index i could check from the background UIColor to see the illuminance?
Take a look at my UIColor category and the blackOrWhiteContrastingColor method. This will tell you what will look better out of black or white. You could extend that to support dark grey as well.
Basically the way it works is to look at the luminosity difference between the target colour and black, and then between the target colour and white. It then chooses the biggest luminosity difference.

Change background color of UIModalTransitionStyleFlipHorizontal

I would like to change the color behind the flip from white to a different color or picture. Is that possible?
Change the background colour of the UIWindow in MainWindow.nib. Either "black" or "clear" should both work (I think...)
It's one of the first things I do to any app, otherwise you get bits of white showing on a view rotation (in the very old days of 2.x there were huge patches of white; they've since masked off the screen edges during a rotation, but a few pixels still show through) and when you show/hide the status bar (e.g. for UIImagePicker) and stuff. Black looks a lot better than white for the window background.