themes: Make background colors partly transparent by default (#24151)

Certain themes define the `created` and `deleted` status colors, but not
`created_background` and `deleted_background`. Previously, Zed would use
`created` and `deleted` colors, and apply a hard-coded opacity change,
but *not* use `created_background` and `deleted_background`, but that
behavior was inadvertently changed in
https://github.com/zed-industries/zed/pull/22994.

This PR restores the old behavior as a fallback. If a theme defines a
status color, but not the corresponding background color, we'll use a
75% transparent version of the foreground color as a fallback.

Release Notes:

- Fixed an issue in certain themes where diffs would render with the
wrong red and green colors for deletions and insertions.
This commit is contained in:
Max Brunsfeld
2025-02-03 22:38:14 +00:00
committed by GitHub
parent e2d6d4bcb2
commit 13b7be12bd
3 changed files with 30 additions and 6 deletions
+3 -3
View File
@@ -102,10 +102,10 @@ impl StatusColors {
conflict_background: red().dark().step_9(),
conflict_border: red().dark().step_9(),
created: grass().dark().step_9(),
created_background: grass().dark().step_9(),
created_background: grass().dark().step_9().opacity(0.25),
created_border: grass().dark().step_9(),
deleted: red().dark().step_9(),
deleted_background: red().dark().step_9(),
deleted_background: red().dark().step_9().opacity(0.25),
deleted_border: red().dark().step_9(),
error: red().dark().step_9(),
error_background: red().dark().step_9(),
@@ -123,7 +123,7 @@ impl StatusColors {
info_background: blue().dark().step_9(),
info_border: blue().dark().step_9(),
modified: yellow().dark().step_9(),
modified_background: yellow().dark().step_9(),
modified_background: yellow().dark().step_9().opacity(0.25),
modified_border: yellow().dark().step_9(),
predictive: neutral().dark_alpha().step_9(),
predictive_background: neutral().dark_alpha().step_9(),