Skip to content

Conversation

@mkrause
Copy link
Collaborator

@mkrause mkrause commented Aug 21, 2025

Update the Switch component to use slightly smarter antialiasing for CSS radial-gradient(). To make radial-gradient() smooth in CSS we need a small bit of antialiasing, however the amount of antialiasing we need depends on the current screen's device pixel width (including the current zoom factor).

Before, we always just used 1px. This PR updates the logic by using window.devicePixelRatio, as described in this article.

Example of Switch at higher zoom levels (previously this would have blurry edges):

Screenshot 2025-08-21 at 22 02 07

@mkrause mkrause self-assigned this Aug 21, 2025
@mkrause mkrause added this to the Baklava v1.0 milestone Aug 21, 2025
@mkrause mkrause merged commit c739d66 into master Aug 22, 2025
4 checks passed
@mkrause mkrause deleted the mkrause/250821-improve-switch-antialias branch August 22, 2025 07:55
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.

3 participants