Sierra Notification Center widgets background colour - macos

Notification Center in Sierra has a new, light background colour compared with Yosemite and El Cap. My widget, however, still shows the old, dark style, even when I rebuild with the new SDK.
The view has appearance set to "Inherited (Vibrant Dark)". Changing that to "Aqua" seems to have no effect.
Is it possible to change third party widgets to look the same as Apple's? I notice all the other third party widgets I look the same.

You need to set the value of NSExtensionPointVersion to 2.0 in your Today extension's Info.plist to get the new appearance:
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>NSExtensionPointVersion</key>
<string>2.0</string>
</dict>
</dict>
The last I checked this was not documented anywhere, but if you create a new Today extension using Xcode 8 it should add this for you, confirming it is the correct approach. (I actually figured it out by inspecting the contents of Apple's own Today extensions.)
One thing worth mentioning is that older versions of macOS will still have the dark appearance, so if your extension is backwards compatible you'll need to adjust your content to suit the background color. In your Today extension's main view controller you can check for the dark appearance like this:
NSString *appearance = self.parentViewController.view.effectiveAppearance.name;
BOOL legacyDarkBackground = ([appearance isEqualToString:NSAppearanceNameVibrantDark]);

Related

How to change statusbar color

I'm creating an app using Xamarin.Forms Shell, but I can't change the statusbar... I managed to change the color of the activebar but the statusbar remains dark blue.(In an Android Device with Android 9.0 Pie)
I googled if there's a way to change the color of the status bar, but what I found didn't take effect... so I wonder if in Xamarin.Forms Shell there is a way to change it. otherwise, is there a way in Xamarin.Forms?(without using the shell).
P.S. On https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/configuration
I see that the iphone has the colored top bar and the device with Android has the status of the black bar, so if one day I will have to use the app in an iphone, does it mean that I will not have this problem? (I assume this also depends on the version of the operating system)
I'd like to read your experience, in the meantime thank you.
Please Add
Window.SetStatusBarColor(Android.Graphics.Color.Argb(255, 0, 255, 0)); this line in your OnCreate() method of android platform.
I change the status bar to green. There is running screenshot.

Change color of selected NSTabView Tab for OS X App

I'm working on an OS X application with Xcode and swift, and I am trying to get the color of the clicked NSTabView to change from it's default blue color. I can't seem to find much information on this, and when I do it is really old. It seems like it is much easier to make changes with iOS, but I specifically need changes on my OS X App in Swift.
Can you not do it within Interface Builder?
I have done that by changing the colour of window where I am switching from one tab to other.
[windowMain setBackgroundColor:[NSColor grayColor]];
or any colour.

missing alignment guides in xcode interface builder

I am new to programming on the Apple Mac. I have followed a programming guide supplied in the Mac Developer Library to program a basic GUI program called TrackMix. In this program you place a textbox, a vertical slider and a button control on the view window. Initially, on dragging the specific object, say the textbox, to the window, a set of alignment guides (dotted blue lines) would automatically appear on the canvas when the object is dragged over it. I dont know what has happened, but now those guides have disappeared when I execute the same action of dragging objects to the window. When the object being dragged is over the window a small green dot, with a plus sign in it, appears on the bottom of the object. I have carefully retraced my steps to be exactly the same as stated in the Developer Library, but still the problem persist. Have I, perhaps, involuntarily changed some Xcode settings or what? I am at the end of my wits! PS: I am using Xcode 7.
You have to toggle the menu item "Editor > Canvas > Snap To Guides" in Storyboard. I hope that helps
I am not sure whether this will be helpful, but I just had the same problem and the only thing which worked was re-installing Xcode (7.3) and trashing all of the Xcode preferences.
Good luck.

Firefox 31 Web Console Layout

Firefox 31 has changed my web console layout and I can't find the option to change it back. Being that I have a widescreen monitor I prefer the console to the right. When I select an array/object to view it opens it in a split as expected, but ever since the update I can't get the split to stack them vertically so they can use more width. Am I just not seeing this option?
Update: For Firefox up to v33 use this plugin, for 34+ behavior has changed. Read this thread on Bugzilla for details: https://bugzilla.mozilla.org/show_bug.cgi?id=1084004
This was added in Firefox 34, now in Beta. It is not in Firefox 33, the current release.
If you have the toolbox docked to the side, the Object Viewer pane will automatically drop to the bottom if the toolbox gets too narrow, see this gif for a visual example:
No, you are not missing the option. The option does not exist.
However, here is a quick-and-dirty extension that does what you want for Firefox 31.0 through 34.0:
http://www.mediafire.com/download/oxt4c5o5vypca85/place-webconsole-object-view-vertical%40makyen.foo.xpi
I tested it on Firefox 31.0, 32.0.1, 32.0.2, 33.0b4 (current beta), and 34.0a2 (Aurora, the current alpha). All of them worked. The file the extension changes, webconsole.xul, has 4 slightly different versions in that range of Firefox releases. One of the changes was between 32.0.1 and 32.0.2.
I had another extension for which I was already working on a similar set of compatibility and testing and then Mozilla released FF 32.0.2 today. Leaving this solution as only compatible for 31.0-32.0.1 just didn't sit well with me, so I did the mods to give it the wider compatibility range.
In 34.0a2 the stock behavior of this part of the webconsole is a bit different. The object view automatically shifts from vertical to horizontal depending on how wide the devtools sidebar is. Visually, this is similar to how the inspector behaves in 31.0 (and later). The above extension, when installed on 34.0b, will lock it in the vertical position. Personally, I really don't like the auto-choosing of vertical/horizontal. I would want a control and be able to lock it the way I want it when I am viewing it. This is not supposed to be a glitzy wiz-bang UI thing to get the masses interested. This is a: I want to get my work done now and I want it my way because that's how I work fastest/best. Sorry, I got up on my soapbox there a bit.
It's the icon that has a rectangle at the bottom. In your case (Where the yellow arrow points):

Changing the mouse's i-beam cursor in Xcode 4

With a dark color scheme in Xcode 4 the i-beam cursor (aka text selection cursor) is nearly invisible. Is there a way to change the color of this cursor, either for Xcode specifically, or failing that, system-wide?
It'd be nice if it would automatically change to a color contrasting its background too.
As of Xcode 8, Apple has hidden the i-beam cursor somewhere where nobody has found it. Instead, many have chosen to use Mousecape to alter the i-beam in all programs. I prefer that method since it fixes the i-beam in other programs that support dark themes, such as Komodo editor. Mousecape should work in all Xcode versions and updating Xcode won't break the cursor. I'm currently using Mousecape in macOS 10.13.2, Xcode 9.1. Here are the steps:
Download Mousecape from here
Download a "cape" with modified i-beam cursor such as Bright white or Grey shadow
Run Mousecape.app
From Mousecape's menu bar: File > Import Cape > "cape" file downloaded above
Right click imported "cape" and choose Apply
Check the new cursor is working in Xcode. When satisfied, you can apply the cursor on each reboot by running a command from Mousecape's menu bar: Mousecape > Install Helper Tool
Installing macOS updates (such as 10.13.1 to 10.13.2) may require repeating steps 5 and 6.
Original answer:
Xcode does NOT use the system-wide i-beam cursor as everyone I found talking about it stated as if it was a known fact. If I hadn't believed those people, I wouldn't have spent two days figuring out how to alter the system i-beam cursor by editing CoreGraphics only to find that Xcode's ibeam doesn't change.
BTW, I also stumbled on how to edit other system cursors.
I spent most of a weekend figuring this out, but the i-beam cursor in Xcode CAN be edited. It's simply a TIFF file in the following location for Xcode 3.2.6 (and earlier, I assume, but have not tested):
/Developer/Library/PrivateFrameworks/XcodeEdit.framework/Versions/A/Resources/TIbeam.tiff
Xcode 4.1 has the same file but it does not affect the i-beam in the main editor (I assume it's used somewhere, but maybe not). Instead, the main editor in Xcode 4.1 uses this file:
/Developer/Library/PrivateFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.tiff
The ibeam files have moved again in Xcode 4.4:
/Applications/Xcode.app/Contents/OtherFrameworks/XcodeEdit.framework/Versions/A/Resources/TIbeam.tiff
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor.png
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/DVTIbeamCursor#2x.png
Editing DVTIbeamCursor.png was enough to change the i-beam in the main editor on my system. On another site, someone reported that DVTIbeamCursor#2x.png will be used on a retina display or Apple's other new high res displays like Thunderbolt and Cinema. Who knows if TIbeam.tiff is even used anymore since they didn't update it to png.
According to comments below, in Xcode 5.0.2 all 3 cursor files were replaced with one file:
/Applications/Xcode.app/Contents/OtherFrameworks/XcodeEdit.framework/Versions/A/Resources/DVTIbeamCursor.tiff
And in 5.1.1 (boy, they sure love to change things in almost every version, don't they?):
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Re‌​sources/DVTIbeamCursor.tiff
I'm guessing that file is a double resolution (aka retina display) cursor that's scaled down for non-retina screens.
If you can't find the ibeam file in your Xcode, try running this command in Terminal:
sudo find / -name 'Ibeam' -print
In Xcode 7.3, the cursor was moved inside the following bundle file so the search command above won't find it:
/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/Assets.car
I recommend using a process found here to patch a new cursor into the bundle file. If you don't like the cursor it installs (I felt it was still too dark and the grey outlines blend in with grey comment text), follow these steps:
Download the latest release of Theme Engine (I successfully used version 1.0.0(111) with Xcode 7.3.1)
Back up /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car
Copy Assets.car somewhere where it can be edited, such as to ~/Documents/Assets.car.
Run Theme Engine.app, click Open Document, then open ~/Documents/Assets.car.
Scroll down the list of items on the left and pick DVTIbeamCursor.
You should see a normal resolution and double resolution ibeam cursor image in the center panel. Drag your own ibeam image on top of either cursor and it should change to show your image. I used a PNG image.
Save, then close Theme Engine.
Move your modified Assets.car back to /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car and keep a backup copy of your modified version somewhere so you don't have to do this again until a new Xcode version changes what's in Assets.car.
You may also wish to send an angry letter to Apple to complain that they have not fixed this problem in the last 7+ years and have instead made it progressively more difficult for users to patch Apple's broken cursor.
Don't forget to keep backups of your edited cursors. Newer Xcode versions will overwrite your custom cursors with default ones when it does a software update.
Here's the ibeam cursor I use: Right click the ibeam and choose to save the image to get the png version, or click here to download the tiff version.
If you're making your own cursor, notice that where the black lines intersect in the original cursor is where the white lines intersect in my cursor. That's because the original cursor was meant to be used on a white background, so its black part is where the cursor hotspot is.
I created a public repo for an ibeam cursor that should work on light and dark colored backgrounds, because it is black with a white outline. It includes succinct instructions, and a TIFF file ready to drop in to the Xcode bundle.
Update: the git repo includes a shell script that makes installation quite easy.
Unfortunately this is a difference between Carbon and Cocoa cursors—Cocoa cursors won't invert; at least, up to Snow Leopard. In Lion, even Carbon cursors behave like you don't want.
If you've got a machine running Snow Leopard or earlier, compare the I-beam behavior in BBEdit or TextWrangler (which use Carbon cursors), for example; it'll become entirely white on a black background. Even this is a bit fragile—when I change the screen magnification, BBEdit's formerly-white cursor becomes black.
You can still set a Carbon cursor in your Cocoa app. Try this in a NSTextView subclass:
#import <Carbon/Carbon.h>
[...]
- (void)resetCursorRects;
{
// disable existing cursor setting behavior
}
- (void)cursorUpdate:(NSEvent *)event;
{
SetThemeCursor(kThemeIBeamCursor);
}
- (void)updateTrackingAreas;
{
for (NSTrackingArea *trackingArea in [self trackingAreas])
[self removeTrackingArea:trackingArea];
NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect options:NSTrackingCursorUpdate | NSTrackingActiveInKeyWindow | NSTrackingInVisibleRect owner:self userInfo:nil];
[self addTrackingArea:trackingArea];
}
(In 64-bit you'll see that this function is excluded from the headers, but the symbol is there and works.) If you're sufficiently motivated, you could potentially patch Xcode to do some variant of the above, perhaps from an Xcode plugin.
If you're on Lion, here's what it is supposed to look like:
So I'd suggest filing a bug with Apple to make the systemwide I-beam cursor (or NSCursor in general) properly handle dark backgrounds; it's not an Xcode-specific issue and it should really have been fixed years ago.
For Xcode 5 preview, i have created a better I-Beam for Dark color templates. You can use it freely.
http://www.scigems.org/wordpress/?p=92
According to this thread on the Apple forums:
https://discussions.apple.com/thread/2811447?start=0&tstart=0
the "cursor color" referred to in the XCode 4 fonts and colors preferences is actually the cursor you see when you have clicked in a window to enter text.
The I-beam cursor you see when you are moving the mouse around in the code editing window is a Mac-OS wide feature which you cannot change in XCode.
The forum post above suggests looking for third party software to change attributes of the system-wide I-beam cursor.
Another post points out that you can at least edit the cursor size to make it more visible:
System Preferences -> Universal Access -> Mouse & Trackpad -> Cursor Size

Resources