Skip to content

Add Liquid Glass effect for Karaoke view (macOS 26+)#159

Open
gitmichaelqiu wants to merge 20 commits into
aviwad:mainfrom
gitmichaelqiu:main
Open

Add Liquid Glass effect for Karaoke view (macOS 26+)#159
gitmichaelqiu wants to merge 20 commits into
aviwad:mainfrom
gitmichaelqiu:main

Conversation

@gitmichaelqiu

Copy link
Copy Markdown

If current system >= 26, use NSGlassEffectView.

Opacity = 0% (with comparison of NSVisualEffectView):
Opacity_0

Opacity = 20%:
Opacity_20

Opacity = 50%:
Opacity_50

@aviwad

aviwad commented Oct 18, 2025

Copy link
Copy Markdown
Owner

Awesome. I'll give it a try.

@gitmichaelqiu

Copy link
Copy Markdown
Author

Found an issue: in the light appearance, if the opacity <30%, because the lyrics are white, the readability will be awful. Sorry, when I was editing, I only tested the dark appearance.

Opacity=0%:

Screenshot 2025-10-19 at 09 08 32

Opacity = 30%:

Screenshot 2025-10-19 at 09 10 29

Although with an opacity of 30% and a white appearance, the "Liquid Glass" effect is barely visible.

So my solution is to use foregroundStyle(.primary) for lyrics and remove .preferredColorScheme(.dark) in FloatingPanel.swift to make it effective:

Opcity = 30%:

Screenshot 2025-10-19 at 09 23 42

Opcity = 0%:

Screenshot 2025-10-19 at 09 23 56

Remove preferred dark scheme for floating panel
@aviwad

aviwad commented Oct 23, 2025

Copy link
Copy Markdown
Owner

Hmm... not a good fix... I generate the color to ensure legibility with white text. (the color I fetch from Spotify is also generated with the use case of having enough contrast against white text). Perhaps we can set a dark mode color scheme on whatever container is holding the NSGlassView? Not sure how to set that in AppKit

@aviwad

aviwad commented Nov 5, 2025

Copy link
Copy Markdown
Owner

Sorry if the previous comment sounded rude. I'm still trying to find a workaround, to force dark mode on the karaoke view's glass. I'm trying to wrap the NSHostingView inside an NSGlassEffectView so the glass is aware of the contents.
image

The problem now comes with communicating the NSHostingView's size changes to the GlassEffectView. I'll figure this out soon. Thank you for the PR!

@gitmichaelqiu

gitmichaelqiu commented Nov 5, 2025

Copy link
Copy Markdown
Author

No worries. I am not offended at all. 😄

And sorry for the late reply, I have edited the code locally and forgot to sync commits to GitHub 😅.

I was working on rewriting the code in SwiftUI because it automatically manages the font/background colors. The current work, in my opinion, looks wonderful!

CleanShot.2025-11-05.at.17.13.36.mp4

When the transparency > 35%, the code forces the foregroundStyle to be white. Otherwise, it is adjusted by SwiftUI.

I have committed the code; only KaraokeView.swift is modified. Currently, there is a drag when a small Karaoke window is expanded to a larger one, because of the default animation of the Liquid Glass (I am finding ways to disable it).

Except that, no obvious bugs are observed.

@gitmichaelqiu

gitmichaelqiu commented Nov 5, 2025

Copy link
Copy Markdown
Author

By the way, because I merged my old branch with your newest one, some other files have changed (to your newest code). I have only changed KaraokeView.swift.

@gitmichaelqiu

Copy link
Copy Markdown
Author

Lemme know if the new method works for you!

@aviwad

aviwad commented Dec 7, 2025

Copy link
Copy Markdown
Owner

Ahh I'm so sorry I haven't been able to review this in time! I graduate in a couple days. I'll take a look soon-ish! Sorry for the wait.

@gitmichaelqiu

Copy link
Copy Markdown
Author

Hi there, I wish all the best.

So I made another batch of updates:

  • The TimelineView of Karaoke will have y-offset oscillate frequently to ensure that the Liquid Glass refraction is always real-time (otherwise the background will stuck there).
  • If the app has a new version, the app updater will abort the Karaoke process. This blocking is removed.
  • I found out that LRCLIB is a more reliable source compared to Spotify, at least on my machine. So I implemented a lyric source picker to prioritize a certain source.

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