A bug in the menu bar of Big Sur?

My app display an icon on the menu bar, and the icon source file is white. I want the icon color to follow the menu bar background color, so I set the "template" property of NSImageview.image to YES, like this:
Code Block
NSImageView *logo = [[NSImageView alloc] init];
logo.image = [[NSBundle mainBundle];
imageForResource:@"LOGO_16_white"];
[logo.image setTemplate:YES];

In most Big Sur and below macOS11, the icon color changes with the menu bar background color, If the menu bar has a light background, the icon color is black, If the menu bar has a dark background, the icon color is white. But on a few MacBooks, the icon color is always gray and does not change.

So is this a bug of Big Sur?
What should I do ?

Thanks!