White background on windows explorer context menu Icon - contextmenu

I have a COM shell extension that adds an item to the Windows Explorer context menu and use a BMP image with a transparent background as the icon.
To set the image I use SetMenuItemBitmaps like so:
[DllImport("user32.dll", ExactSpelling = true)]
internal static extern int SetMenuItemBitmaps(IntPtr hMenu,uint uPosition,uint uFlags,IntPtr hBitmapUnchecked,IntPtr hBitmapChecked);
SetMenuItemBitmaps(owner.hMenu,(uint)pos,Win32.MF_BYPOSITION,bitmap.GetHbitmap(),IntPtr.Zero);
My problem is this - when the icon first appears it looks fine but after hovering above it the icon's background becomes white (instead of transparent) and remains white until I reopen the menu.
I have tried setting both non default values in the parameters "hBitmapUnchecked", "hBitmapChecked" - but it doesn't seem to make any difference. The outcome remains the same.
This is the icon image before the hover (zoomed to 400%):
This is the icon image after the hover:
Note the white background around the second image!
So far, I've failed to find anything relevant on google.
Is there some other way to set the icon to avoid this annoying background?

Related

SF Symbols Multicolored icons

Im making an app with weather icons, and i wanted to use apple's SF Symbols! At WWDC2020 they released multicolred ones.
So my question is, why are my icons appearing in black like so:
I have set the rendering mode to alwaysOriginal. And it does nothing. If i set it to template it becomes blue, like the default tint color.
currentConditionImageView.image = UIImage(systemName: "cloud.sun.fill")!.withRenderingMode(.alwaysOriginal)
But according to the SF Symbols app, the symbol should look like this:
Has anyone encountered this Problem, and how did you solve it?
Im looking forward to your answers!
The rule is:
In a template environment, such as a button, if you apply the .alwaysOriginal rendering mode to a multicolor symbol image, its inherent colors will appear.
But an image view is not a template environment. Try making this image the image (not the background image) of a UIButton.
If you put a multicolored image in a non-template environment, like an image view, you are basically misusing it if you make it .alwaysOriginal. You should just make it .alwaysTemplate and accept it as a monochrome image adopting the tint color.

How do I change the color of the push notification icon in flutter? [duplicate]

I tried making the small icon exactly 16x16, gray-scaled, nothing but gray and white (the gray color being hex value 616161), to create a silhouette of my application icon.
Yet no matter what it just shows up as a white/gray square in the notifications. What am I doing wrong?
(My min api is 21, assuming it is relevant)
Follow this link
First let’s understand the Android documentation which is as follows
“Update or remove assets that involve color. The system ignores all
non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.”
Now this is easy to miss and I have seen many apps that are live in the app store with thousands of users who haven’t followed the mentioned guidelines.
So let me explain in detail how you can convert your notification icon to an Android friendly one with a few clicks.
In your favourite image editor open up your icon file. Convert all parts of the image that you don’t want to show to transparent pixels. All colors and non transparent pixels are displayed in white. Let us go through an example.
EDITED: Thanks #Andrey Patseiko for the tool
For notification you have to use different icons for different versions of android:
Notification notification = new Notification.Builder(context)
.setAutoCancel(true)
.setContentTitle("My notification")
.setContentText("Look, white in Lollipop, else color!")
.setSmallIcon(getNotificationIcon())
.build();
return notification;
Get notification icon on the basis of version
private int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
}
Along with new features and capabilities, Android 5.0 includes a variety of system changes and API behavior changes. See the notification behavior changes.
Notifications are drawn with dark text atop white (or very light)
backgrounds to match the new material design widgets. Make sure that
all your notifications look right with the new color scheme. If your
notifications look wrong, fix them:
Use setColor() to set an accent color in a circle behind your icon image.
Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.
So, basically you have to use silhouette icons as notification icon for API Level 21+

iOS overrides the `navBarButtonColor` when using PNGs

Issue Description
In my application I have a navigation bar search button set up as follows:
static navigatorButtons = {
leftButtons: [
{
id: 'back-nav-button',
icon: require('../assets/images/icons/arrow-left.png')
}
]
};
The button works as intended on both iOS and Android, but the button is blue on iOS. I understand that this is the desired behavior and that the color can be overridden by setting navBarButtonColor, but the problem is that it's a multi-colored button - meaning I want then button to simply contain the PNG image's colors, and not the navBarButtonColor.
I've tried setting navBarButtonColor to null, transparent, but nothing seems to work.
So my question is, is there a way to make navigation bar icons take on the color of the PNG provided, as is the case on Android?
Steps to Reproduce / Code Snippets / Screenshots
Simply run any RNN app on iOS with a simple static navigatorButtons = ... using a local multi-colored PNG and you'll see the colors of the icon get overwritten.
Environment
React Native Navigation version: 1.1.473
React Native version: 0.55.3
Platform(s) (iOS, Android, or both?): iOS
Device info (Simulator/Device? OS version? Debug/Release?): Android Emulator on Debug
On iOS, UIBarButtonItem uses images created with source image's alpha channel. To display the actual image (not an alpha channel mask of it) you need to change your image's rendering mode to alwaysOriginal
Although, looking at React Native Image class documentation I can't see renderingMode property
We've managed to find a workaround for this. By setting the disableIconTint button property to true, it disables the icon color override. See the following example:
static navigatorButtons = {
leftButtons: [
{
id: 'back-nav-button',
icon: require('../assets/images/icons/arrow-left.png'),
disableIconTint: true // Add this line to use the PNG's color
}
]
};

3D Touch shortcuts - Color Icon

I know how to develop 3D touch shortcuts with customized icon (grayscale) but my question is is there any possiblility to put colored image as a shortcut icon? I have tried a colored image with
UIApplicationShortcutIcon *logoIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:#"field_valid"]
...but it won't appear. With a grayscale icon, it is working fine.
Sure you can but only with contact images.
See UIApplicationShortcutIcon:
init(contact: CNContact)
Creates a Home screen quick action icon
from the picture for a contact if available, or else creates a
monogram from the contact name.
Source: https://developer.apple.com/documentation/uikit/uiapplicationshortcuticon
According to iOS Human Interface Guidelines, this is not permitted.
From the Home Screen Actions section:
Don't use an emoji in place of an icon. Emojis don't align properly with right-aligned text. Also, emojis are full color, whereas quick action icons are monochromatic.

UITabBar Large Content Size Image (HUD) doesn't display in Large Text mode

iOS 11 has an accessibility feature that shows a large version of a tabbar icon in a pop-up HUD when long pressed. In a WWDC presentation, it was mentioned this just involves turning on:
Settings -> General -> Accessibility -> Larger Text
..and adding:
tabBarItem.largeContentSizeImage = UIImage(named: "myHud")
Alternatively, you can add a vector image as the main tool-bar image, with 'Preserve Vector Data' checked in the asset catalog.
I've tried all combinations of this, and a long press does not show the HUD. I also tested with the Files app on my iPad running iOS 11b4 with no luck. This is the app that was demoed at WWDC.
Is there some other accessibility setting I'm missing to enable this feature? Or is it not available in beta 4?
It isn't enough to turn on Larger Text. You also have to use Larger Text — i.e. slide the slider way to right.
Then it works — well, the HUD appears. But the icon is not being enlarged within the HUD, so I don't quite see the point:
(As you can see, I'm doing this in a test project where I'm experimenting with the vector PDF image feature.)
This feature implementation and an example with tab bar are perfectly explained with illustrations on this accessibility site but here are the outlines :
Under Xcode, import the image to be enlarged with a pdf extension and a x1 resolution in the xcassets catalog.
In the new Image Set, tick Preserve Vector Data and specify Single Scale as Scales attribute.
If a storyboard is used for this image, tick Adjusts Image Size in the Image View section, otherwise put the adjustsImageSizeForAccessibilityContentSizeCategory image property to true in code.
For your tab bar or tool bar used in the application, first repeat the previous 3 steps for each image included in the items to be enlarged in the middle of the screen and then link the accessibility image to its appropriate item.
This feature is available only for the accessibility text sizes.
WARNING : don't forget to check your layout with these new images larger sizes.
For your record, an explanation of the Large Content Viewer is provided in this detailed WWDC video summary if need be ⟹ the UILargeContentViewerItem protocol is an iOS 13 new feature that shows the same HUD that's shown for standard bar items.
You need to go :
Settings > General > Accessibility > Larger Text(set on) > Move slider more then half to the right
Don't forget to set
tabBarItem.largeContentSizeImage = someKindOfImage
And Long press will does the trick.

Resources