Skip to content

Made menus render full color - #779

Merged
stackotter merged 4 commits into
moreSwift:mainfrom
MiaKoring:test-dim-menu-items
Sep 18, 2026
Merged

stackotter merged 4 commits into
moreSwift:mainfrom
MiaKoring:test-dim-menu-items

Conversation

@MiaKoring

@MiaKoring MiaKoring commented Sep 15, 2026

Copy link
Copy Markdown
Member

resolves #777

NSMenuItems (the popup things of Picker and Menu) now render their full color, overriding appkit’s vibrancy stuff.

An exception are Text() in Menu, but that isn’t caused by vibrancy but the lack of an action, since in reality it’s just a button.

The benefit: it renders exactly like appkit normally would and supports colorScheme overrides. And it matches Menu buttons
The caveat: overriding the color doesn’t adapt just like the default, but that’s in the user’s hands.

The reasons: Using a non-adaptive NSColor makes AppKit apply vibrancy stuff, which makes our supplied white grey-ish.
Pretending to be adaptive with the environment dictated color makes the color render correctly, but in light mode it doesn’t change anymore for highlighted, which it does in appkit.

Therefore I decided to use .textColor if suggestedForegroundColor matches the colorscheme’s default and vibrancyOverride with the requested color for everything else. That way you get the correct behaviour without losing the ability to override it.

stackotter
stackotter previously approved these changes Sep 16, 2026

@stackotter stackotter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, and this fix appears to work basically as could as I would've hoped in practice! I think I misunderstood you when we were talking about this on Discord, cause I don't see anything wrong with this way of doing things (other than not making the hover color have correct contrast for custom colors, but that's a tiny issue imo). I think I hadn't realized that you had found a way to disable vibrancy for arbitrary colors

@stackotter

Copy link
Copy Markdown
Collaborator

Happy to merge once this PR is updated to get the fixed CI from main

@stackotter

stackotter commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Oh no, a conflict has appeared 😅

@stackotter
stackotter merged commit 3024a35 into moreSwift:main Sep 18, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppKitBackend: Picker items appear dim

2 participants