Windows Toast notification application icon colors inverted - windows

I have a windows application with toast notifications (using Windows.UI.Notifications.ToastNotification). The problem is that when the application has a dark icon and the dark windows theme is applied, the application icon is getting inverted colors in notifications (in popups and in action center). I'm talking about the icon in the attribution area according to this description. Is there any way to forbid the system to invert icon colors?

It looks like windows takes the decision to invert the icon or not according to the colors of the pixels on the border of the image. A little enlightening of border pixels do the trick and the system stops inverting the colors.

Related

Finder toolbar icons are jagged or anti-aliased on non-retina displays

I'm trying to create Finder toolbar icons that match the look and feel of Monterey, but they seem to be jagged as if there are issues with anti-aliasing.
Here are the retina icons I'm trying to convert (two on the right):
And here is how they look on my non-retina display:
At first, I thought this was simply a problem with automatic anti-aliasing. However, when I manually resize the icons to 32x32, this is how they're supposed to look:
But when I use those icons in Finder, they look jagged all over again. I have no idea what is happening.
Update
Steps to reproduce:
Take icon_terminal_light.icns from this icon pack
If you already have a custom Finder toolbar icon, skip to step 6
Right-click on your Finder toolbar and choose "Customize Toolbar"
Click-and-drag any application onto the toolbar
Click "Done"
Right-click on your application and choose "Get Info"
Click-and-drag icon_terminal_light.icns onto the icon in the upper-left
Notice:
If you move the Finder toolbar to a non-retina screen, the icon will look thin and the edges will be jagged.
You can even open icon_terminal_light.icns in Preview, resize it to 32x32, and then export it to a new icns file. The icns file will look smooth on a non-retina monitor, but if you try putting it into the toolbar, it'll be jagged once again.
Finder has a quirk whereby the alpha layers of toolbar icons get multiplied by two when the window is active. If the Finder window is in the background, however, the icons probably look how'd you expect.
If your icons have any thin graphical element, the anti-aliased pixels will have low alpha values. When those alpha values are doubled, the pixels practically disappear, which is what looks like is happening.
I solved this issue when trying to resize the icons provided in OpenInTerminal-Light. My solution is a bit of a hack:
To fix the rendering, I manually resized the icons and added 89% gray behind the anti-aliased pixels. Every pixel has either 0% or 100% alpha now.
You can see more detailed notes in the issue I opened on GitHub.

OSX NSStatusBar statusbar icon dimensions?

I couldn't find a document or hint which dimensions a statusbar or menubar icon in OSX should have. I found out that such an icon has 18x18 pixel for normal displays, but how to do that for retina displays? Is it 36x36 and are the usually naming coventions ...#2 working in this case?
The official apple docs covers informations of all other icon sizes, but nothing about a status bar icon.
From the docs:
When you create an icon to put inside a toolbar control in PDF format,
OS X will automatically scale your icon for high-resolution display.
You do not need to provide a high-resolution version.
there is no #2X version.
For freestanding icons in a toolbar, create inviting images that are
easy to identify. Because freestanding toolbar icons do not need to
fit within a toolbar control, you have a little more room to express
them. As you design a freestanding icon for your toolbar, follow these
guidelines:
Use a straight-on perspective. Make the outline sharp and clear. Use
anti-aliasing. Use color judiciously to add meaning. Create icons for
standard- and high-resolution displays. You need to supply two
resources: 32x32 and 32x32#2x. See Table 5-1 for the corresponding
canvas sizes. Use the PNG format.
For reference

Icons editable in Visual Studio, but appear blank in other editors

Odd one, this. The project I'm working on includes some small icons (.ico file type) in a Windows resource (.rc) file, all 10x10 black on transparent.
Opening these icons in Visual Studio 2010 correctly brings up the icon editor, showing the icon in salmon-pink on teal-green. The icon's properties in VS show it as "10x10, 4 bit, BMP". The app that includes the icons displays them fine.
However, I cannot view or edit them in external editors! Windows 7 explorer's thumbnail view is blank white; MS Paint also loads them as 10x10 blank white images. Paint.Net (with the .ico plugin) thinks they're 10x10 transparent images. Windows file properties reports them as 10x10, 32-bit icons.
What's going on?
An icon contains 3 distinct bitmaps. Two monochrome ones and, in your case, a 4bpp bitmap. The monochrome bitmaps determine how the pixels are displayed. One of them determines whether a pixel is transparent, it shows up as teal green in the icon editor. The other determines whether a pixel is actually the background pixel inverted, it shows up as pink salmon in the icon editor.
So if you only see teal and pink then your 4bpp bitmap does not contribute anything at all to the visible icon. Whatever other icon viewer you are using to look at the icon is tripped up by that. Which is not unusual, inverting background pixels made only sense in the early days of Windows, back when displays had a very limited number of colors. Like 4bpp.
Fix it by using real colors in the 4bpp bitmap. Or don't worry about it if you are always displaying the icon on a well known background. Which is not typical btw, the user can change the color scheme setting for the window title bar for example. Or change the wall paper image for the desktop. The resulting icon color will be pretty random.

Is it possible to change the glass color only for my own forms?

I would like to create my application forms in the color independent from the user's color settings of the Aero. Is it possible to colorize my forms with the selected color without affecting the user's settings ?
This I want to do only for the Windows Aero colors.
Thanks
No, you can't do that, the glass composition color is system wide. As workaround you can draw a 32 bits bitmap of a solid color over the form using the Windows.AlphaBlend function.

Find out the background color of Windows system tray to select the tray icon for my app

I'm writing a Windows application that displays its tray icon on the Windows system tray (next to the system clock). The problem is that my icon looks great on some backgrounds and looks horrible on others. One would solve this issue by creating a shadow or an outline around an icon, but the tray icon is just 16x16 pixels, which makes the former quite difficult to achieve.
So I was curious, is there a way to find out what system tray background is, that my icon is displayed on, as RGBA mean value, for instance? (I understand that it is now not a solid color, thus the word "mean".) And if so, I'm sure there's an algorithm to determine if it's a bright (gray, silver) vs. dark background (blue or black). This will let me load either dark or bright verson of my tray icon.
As you provide an icon only, you don't have an option to paint the area where the icon is supposed to be shown. With Aero off, the color is expected to be GetSysColor(COLOR_BTNFACE), otherwise things are more complicated and transparency involved so that windows underneath the appbar actually affect background color around system tray icon.

Resources