zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.55k stars 3.13k forks source link

Theme can no longer control hover color for some buttons since v0.137.2 #12592

Open kpitt opened 5 months ago

kpitt commented 5 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

In Zed 0.136.2, the hover background of a Filled button was controlled by the "element.hover" color in the selected theme. Starting in stable release v0.137.2, the "element.hover" color no longer has any effect.

One example where this occurs is for an IconButton in the Extensions view. To better demonstrate the issue, I set the colors so that the "element.background" colors used for the button and the "elevated_surface.background" used for the extension card are the same.

Screenshot 2024-06-02 at 7 08 54 PM

I used the "experimental.theme_overrides" to set "element.hover" to a bright purple so that it easy to distinguish. The first image below shows the hover effect on v0.136.2, and the second shows the exact same hover when running v0.137.6:

Screenshot 2024-06-02 at 7 09 38 PMScreenshot 2024-06-02 at 7 11 12 PM

Environment

Zed: v0.137.6 (Zed) OS: macOS 14.5.0 Memory: 32 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

The problem appears to have originated with the changes to button_like.rs in commit 9c1e3ce470adda164065f065bf07400ccfa34908. As a theme author, I appreciate the intent of this change, because one of the big limitations with the current theme system is that the same color definitions are used against very different backgrounds depending on the context. Unfortunately, this changes the hover state to just add some alpha transparency to the same background color as the normal Filled button, which actually takes away control from the theme author rather than giving more control.

The biggest problem here, however, is the following code line:

    filled_background.fade_out(0.92);

This reduces the alpha value by 92%, which means that the final alpha value for a background color that started as 100% opaque will be only 8%, and I suspect this is not what the author intended. I overrode the "elevated_surface.background" color for the extension card to a bright green to demonstrate the effect of this. Even with the extreme contrast between the card background and the button background, the hover color is only barely distinguishable from the card background.

Screenshot 2024-06-02 at 7 19 21 PMScreenshot 2024-06-02 at 7 18 55 PM

My preference for the long term would be to have specific control over each element so the theme can determine which elements should use the same colors and which should not. For the short term, however, I would like to see this hover color reverted back to use "element.hover", which at least allows me to choose a hover color that provides a reasonable compromise against all the possible surface backgrounds.

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

JosephTLyons commented 5 months ago

cc: @maxdeviant