I am building a small utility app for macOS that combines SpriteKit with AppKit. Specifically, I am using an SKView as the "background" for the app window (mostly for specific types of animations that are easier in SpriteKit). I am also changing colors of the Window's background property to adjust the title bar color. Switching between green and red.
The issue I am running into is matching colors between AppKit and SpriteKit. In short, they don't match. As you can see in the image the title bar is a bit different than the SKView.
After a bit of playing, I found that the background color in the SKView is in the "Device RGB colorspace" and the Window's colors are in "sRGB IEC61966-2.1 colorspace." I changed the AppKit colors to device RGB and the colors still don't match.
I'm creating the colors with a regular old NSColor initializer.
I'm not sure if you can change the color space of a color. The backgroundColor property on the Window and SKView is read only.
Any ideas?
if im reading this right what you are wanting to do is match colors could you not just do something like yourAppKit.backgroundColor = yourSKView.backgroundColor that should set them to equal
and my second question is do you need them to match? most of the time people arent gonna notice and if they do notice they wont really care
also here is some data on converting RGB to sRGB
My guess is that this is due toNSWindow.StyleMask.fullSizeContentView. When this is set, the title bar applies a blur by default.
If you want the colors to be the same, tell the window to use a transparent title bar:
window.titlebarAppearsTransparent = true
Related
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!
I want to place a blur effect on top of a view with gradient. When I do so using the UIVisualEffectView combined with the UIBlurEffect light, I get the following result:
As you can see, the navigation bar is very bright. I'd like it to not be tinted with white color, or what this might be, but instead actually just blur the background.
I noticed that when dragging down the notification center / lockscreen on iOS 11, the blur is not so bright, even though the background gradient is exactly the same:
I was thinking this could be done using the tintColor property of UIVisualEffectView, but changing it did not have any effect whatsoever.
Is there any way I can reproduce the blur effect shown in the image above, using standard Swift libraries?
Edit
Since there haven’t been any responses whatsoever, I’m guessing there’s no way to do it natively.
If someone can recommend a good library, I’m open to that too.
Thanks!
just like the popover in the attached screenshots, the popover allow user to change themes.
I know that there are some examples around but they are all using images to achieve this, make it hard to change themes.
I believe the app in the screenshots doesn't using images to do it.
thanks for any help!
In my Win background such skins (called "Flat" in Delphi and WinForms) were made by drawing in code: select a color, draw a line, select another color, draw a rounded rectangle and so on.
Also, it is necessary to introduce a class "ColorTheme" with a set of fields for every color used. You may have several ColorTheme instances and swap them when you need to change color theme.
I am doing some work with a custom UITableViewCell,and I am trying to find out the RGB value of the UITableViewCellSelectionStyleBlue. For long detailed reasons, I will not be using the delivered selection style. Is the blue selection style color solid (it looks to be so) or a gradient? Any help or a point in the right direction to replicate this color/style would be appreciated.
Get an image editing program such as Graphic Converter. With most of these when one entered color selection mode there is usually a pointer that can be hovered over the screen and it will display the color values. I also will take a screenshot, open it in GC and display it at 200% or 400% to get accurate colors and sizes.
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.