Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the application's dark mode to follow the app settings on macOS. #10177

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fireblue
Copy link
Contributor

@fireblue fireblue commented Jan 9, 2025

Hi,

Last time I fixed the vibrancy issue on macOS: #9899
Somehow I still feel something strange in the vibrancy effect on macOS.

After some digging, I've found that the translucent effect of an Electron app's background on macOS is implemented by using NSVisualEffectView, which adapts to the system's dark mode setting in default—black in dark mode and white in light mode.

Tabby did not set the app-level dark mode configuration, so it defaults to following the system's dark mode setting.

As a result, when the macOS system dark mode is set to light, Tabby's dark theme background will mix with a white background, and appears washed out.

I updated the code to make Tabby's dark mode follow the app's internal settings, and dark themes look better.

I made two screenshots to show the difference with the following custom css:

terminal-toolbar {
    opacity: 0.8 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
}
.tabby {
    opacity: 0.75 !important;
}

The old code has the same effect with "always light"
截屏2025-01-09 18 26 26

The new code has a darker and more translucent(which appears) background:
截屏2025-01-09 17 12 06

I think we can ultimately achieve a near-transparent black glass like effect by configuring the material and opacity of the NSVisualEffectView, but Electron does not expose an interface for us to modify these parameters. Will try to dig further.

@fireblue
Copy link
Contributor Author

fireblue commented Jan 9, 2025

Currently the dark mode is applied to macOS only because I'm worried about the possiblity of breaking something else on other platforms.

@Eugeny
Copy link
Owner

Eugeny commented Jan 9, 2025

Tested it and it looks good 👍
However you can't import electron from plugins other than tabby-electron as it will break tabby-web.

You could send the message from updateVibrancy() in tabby-electron instead

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.

2 participants