Skip to content

[FEATURE REQUEST] Background: a gradient over the picture - #81

Closed
Dararaaaa wants to merge 1 commit into
ELY-Open-Source:mainfrom
Dararaaaa:feat/background-gradient
Closed

Dararaaaa wants to merge 1 commit into
ELY-Open-Source:mainfrom
Dararaaaa:feat/background-gradient

Conversation

@Dararaaaa

@Dararaaaa Dararaaaa commented Nov 6, 2026 •

Copy link
Copy Markdown

[FEATURE REQUEST] Background: a gradient over the picture

Type

  • Feature

What and why

The picture can now wear a gradient over it, as CSS's linear-gradient does: an angle, a start color and an end color, in Settings › Appearance › Background.

  • background_gradient switches it (false by default).
  • background_gradient_angle turns it: 0 draws upward, and degrees increase clockwise, 0 to 360 (180.0 by default, top to bottom).
  • background_gradient_from and background_gradient_to are its colors, read by src/settings/color.rs: #rgb, #rrggbb, #rrggbbaa, rgb(...), rgba(...), transparent, black and white (#00000000 both by default).
  • The colors are strings, so a settings file speaks CSS and an alpha keeps its exact value (#202030cc never lands in a float's noise).

The gradient paints over the picture, across the picture's box — the terminal's column or the whole window, as Picture scope says — at the background opacity. gpui draws two stops only, so two colors are all.

validate() refuses an angle outside 0 to 360 and a color that does not read: the row shows why under the field and the saved value stays.

How it was tested

  • Rebased onto upstream/main (fdca49a, which already carries PR1 and PR2) as 18512c7; the wallpaper, PRD, AGENTS, acceptance and both feature docs were merged against the T163/T164 changes already on main.
  • cargo build, cargo fmt --all -- --check clean, cargo clippy --all-targets -- -D warnings clean.
  • cargo test --lib: 443 passed; the 8 failures are the suite's sandbox-bound shell and registry tests, as on main.
  • New tests: settings::color (each hex form, rgb/rgba, what is not a color), settings::tests::a_gradient_keeps_its_angle_and_colors (defaults, an angle and colors read back, a bad color refused), and the wallpaper's gradient tests.
  • On screen: with background_gradient: true, angle 180 and #202030cc to #00000000, the picture dims toward the bottom; with #ff0000cc the gradient tints it red at the top, so it paints over the picture.

Screenshots

image image

Checklist

  • Hand-written files stay at or under 500 lines; comments one line.
  • scripts/check.sh: fmt, clippy and tests clean, the sandbox's 8 known failures aside.
  • PRD.md, AGENTS.md and tasks/acceptance.md updated.

@Raiden-MeixElysia

Copy link
Copy Markdown
Contributor

Merged into main with you as the author, as 8ff412c, and one change on top, 69080d7:

  • The gradient paints only over a picture that drew. With no picture the columns' glass grounds the window, and a gradient alone made wallpaper::paint lay a second ground over it.
  • The settings refuse a color that does not read before it is ever stored, so the paint code expects the two colors; the once-per-pair log and its thread-local went.

It ships in 0.2.4. Thank you.

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