Set tintColor in macCatalyst - swift

In macOS Big Sur a multicolor accent color is allowed, no longer overwriting an app’s custom tint color (in theory).
This can be seen in a few system apps:
(images from this tweet)
However setting the tintColor property of a view, a window, or even UIView.appearance() still results in the default blue in macCatalyst. Not even setting onTintColor of a checkbox (UISwitch) has any effect.
Is this a bug or is there a correct way to do this?

You do it the same way you set tint color for a Watch app:
Open the app’s asset catalog.
Select the Editor > Add New Asset > Color Set menu item to add a new color set to the asset catalog.
In the app’s Build Settings, set the “Global Accent Color Name” to your color set’s name.
Apple’s WatchKit instructions are here, but it’s actually the same for all platforms: https://developer.apple.com/documentation/watchkit/setting_the_app_s_tint_color

Related

Change safe area color in dark mode

I am using this code:
window?.safeAreaLayoutGuide.owningView?.backgroundColor =
UIColor(red:243.0/255.0, green:243.0/255.0, blue:243.0/255.0, alpha:1.0)
in SceneDelegate for change safe area color. And I want to change color of safe area for dark mode.
How can I do?
The best way to do this is to set up a Color Asset which has both light mode and dark mode variants included. This is simple to do, and once you have it set up, light/dark mode transitions will be handled automatically.
First, select your Assets.xcassets file, and right click anywhere within the left hand sidebar (under where it says "AccentColor" and "AppIcon"). This will open a popup menu; from there select "New Color Set." Now you should see a square named "Color" in the sidebar, and two squares labeled "Any Appearance" and "Dark" in the middle of the screen.
Next, click on one of those two squares. In the right hand sidebar, a color selector will pop up (with red, green, blue and opacity sliders, and the option to open the color selector panel). You can use these to set the RGB values you want for both light mode (the "Any Appearance" square) and dark mode.
Now that you've specified the color values, you still need a way to reference your new Color Asset from your code. This can be done with the UIColor(named: String) initializer. In Assets.xcassets, change the name from Color to whatever you want it to be called (I'll use "SafeAreaColor" as an example). Now, somewhere in your program (I usually do this in the Constants file) you should initialize the color:
let safeAreaColor = UIColor(named: "SafeAreaColor")
The last step is to incorporate this custom color into your existing code:
window?.safeAreaLayoutGuide.owningView?.backgroundColor = safeAreaColor
Now, your safe area should automatically change colors when the device shifts between Light and Dark mode.

How can I adjust Flutter such that Fleksy recognizes colors and changes accordingly?

I'm making an app and I can't figure out what I need to change in order to make Fleksy recognize colors and change accordingly.
Fleksy is a keyboard app on devices that has a chameleon theme which changes according to the apps' color.
For instance, my app's main colors are white and red. Thus, in order to match general theme, I want Fleksy to change it's color to red whenever keyboard appears on the screen.
Is there something that I have to do within Flutter or there's a specific way to make this work?

Change background color of flutter app icon

I want to change background icon to #fe6017.
I use flutter_launcher_icons, set adaptive_icon_background: "#fe6017". But it doesn't work.
I also try to resize image. But it always shrinks and put white color around my image. Thank you.
Open android folder in Android Studio.
Right-click the res folder and select New > Image Asset.
In the Icon Type field, select Launcher Icons (Adaptive & Legacy).
In the Foreground Layer tab, select an Asset Type, and then specify the asset in the field underneath:
Select Image to specify the path for an image file.
* Select Clip Art to specify an image from the material design icon set.
* Select Text to specify a text string and select a font.
In the Background Layer tab, select an Asset Type, and then specify the asset in the field underneath. You can either select a color or specify an image to use as the background layer.
In the Legacy tab, review the default settings and confirm you want to generate legacy, round, and Google Play Store icons.
Optionally change the name and display settings for each of the Foreground Layer and Background Layer tabs:
Name - If you don't want to use the default name, type a new name. If that resource name already exists in the project, as indicated by an error at the bottom of the wizard, it's overwritten. The name can contain lowercase characters, underscores, and digits only.
Trim - To adjust the margin between the icon graphic and border in the source asset, select Yes. This operation removes transparent space, while preserving the aspect ratio. To leave the source asset unchanged, select No.
Color - To change the color for a Clip Art or Text icon, click the field. In the Select Color dialog, specify a color and then click Choose. The new value appears in the field.
Resize - Use the slider to specify a scaling factor in percent to resize an Image, Clip Art, or Text icon. This control is disabled for the background layer when you specify a Color asset type.
Click Next.
Optionally, change the resource directory: Select the resource source set where you want to add the image asset: src/main/res, src/debug/res, src/release/res, or a custom source set. The main source set applies to all build variants, including debug and release. The debug and release source sets override the main source set and apply to one version of a build. The debug source set is for debugging only. To define a new source set, select File > Project Structure > app > Build Types. For example, you can define a beta source set and create a version of an icon that includes the text "BETA" in the bottom right corner. For more information, see Configure Build Variants.
Click Finish. Image Asset Studio adds the images to the mipmap folders for the different densities.
You can create an image filled with color #fe6017 and use it for adaptive_icon_background as in example
flutter_icons:
android: "launcher_icon"
ios: false
image_path: "assets/icon/icon.png"
adaptive_icon_background: "assets/icon/icon-background.png"
adaptive_icon_foreground: "assets/icon/icon.png"

How to change the background color of the Settings page and not the Editor?

How do I change the background color of the Settings page, not the Editor, but the Settings page? I know it probably involves changing a workbench.colorCustomization token, but I don't know which one it is or if it even exists. Also, is there some sort of extension that allows you to inspect the UI elements/icons of VS Code?
I have already tried changing the editor.background token, which applied to not just the Editor, but also the Welcome and Settings pages. I was able to change the background color for the Welcome page using the welcomePage.background token, but I don't know how to change it for Settings.
I want the Settings background color to change so I can see it better.
It doesn't look like you can. If under workbench.colorCustomizations you type settings you will get the list of available settings page items of which you can change the color.
Perhaps one or more of the foreground colors to change the text color will help you.
The Custom CSS and JS Loader may allow you to change the color of the settings page. You can inspect vscode's elements by Help/Toggle Developer Tools to find out what element you need to target with that extension.
<div class="settings-editor " or a child of that. Set its background-color to what you want using that extension.

UILabel automatically changes color

i'm facing a really strange problem: i have some UILabel in my view, which has a black background, so i set their text color to white in Interface Builder in order to see them, the problem is, when i run the app on the simulator or on my iphone with ios7 or iOS 6.1.3 i can update them without problems (for update i mean: myLabel.text = #"Something")
but when i run the app on my sister's iphone 3gs with iOS 6.0 at the moment i update them the font color turns black. It seems that on her phone the label can't remember the color set on IB.
Does anyone of you know why this happens?
Thanks
It sounds like you have set the label "type" to "Attributed" in Interface Builder.
If this is the case then it is not the label that holds the text colour. It is the text itself.
If you replace the text with something else then the default text color of black will be used.
If you want to continue using Attributed text then you need to add a "foregroundColor" attribute to the text before setting it to the label.
The easier way round this is to change the label type to "Plain" in Interface Builder.
Of course, this depends on you having set it to Attributed.
I think you shouldn't use default label color in the interface builder, just provide something else (black color or etc.).
I ran into a similar problem. Was stumping me completely, until I quit and relaunched the simulator. It wasn't enough to just close the window or rebuild. I had to cmd-q, then build and launch again. Magically fixed the issue. Annoying.. but worked for me