gpt4 book ai didi

macos - NSPopover + NSBox 的深色模式色调/ Gamma 问题

转载 作者:行者123 更新时间:2023-12-03 17:37:38 24 4
gpt4 key购买 nike

我有 NSPopoverNSBox , subview 是:MKMapViewNSImageView。在黑暗模式下,整个 NSBox 向所有 subview 添加 Gamma /色调。这不会出现在灯光模式下(比较下面的图像)。这似乎与NSVisualEffectView有关。我怎样才能防止/禁用这种效果?

PS:该效果在普通窗口中不显示。仅弹出窗口受到影响。

Dark mode Light mode

开箱即用的拖放元素代码。 Mojave 10.14.4

- (IBAction)showPopover:(id)sender {
[[self popover] showRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSRectEdgeMaxX];
}

编辑:2020 年 4 月根据“采用 os x yosemite 新用户界面的高级功能”(youtube),这是由于填充颜色的一些活力效果而发生的。弹出窗口具有 NSVibrantDarkAppearance 的有效外观

(lldb) po [self.view .effectiveAppearance]
▿ 1 element
- 0 : <NSCompositeAppearance: 0x60000210a940
(
"<NSVibrantDarkAppearance: 0x60000170b840>",
"<NSDarkAquaAppearance: 0x60000170ae80>",
"<NSSystemAppearance: 0x60000170afc0>"
)>
lldb) po [self.view .superview]
▿ 1 element
▿ 0 : Optional<NSView>
- some : <NSPopoverFrame: 0x1020a63f0; material: Popover; blendingMode: BehindWindow; state: Active>

因此其他可能的解决方案是使用不鲜艳的填充颜色。

最佳答案

通过在 NSBox 后面添加额外的 NSVisualEffectView 来解决,其中混合设置为在窗口内发生。左(有视觉效果图)、右(无视觉效果图)。

enter image description here

关于macos - NSPopover + NSBox 的深色模式色调/ Gamma 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56129860/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com