Skip to content

Conversation

@huacnlee
Copy link
Contributor

@huacnlee huacnlee commented Nov 5, 2025

Release Notes:

  • N/A

I was changed Fill to use Background since PR #20812.

But it's not inconvenient to retrieve the background color already set in the current style.

For example: I have use StyleRefinement a lot in GPUI Component, I may define a style for an element and impl Styled for MyElement for allows user to override the element default style.

In this case, I often need to get the bg of user sets to do something, e.g.: Adjust that color opacity to border use.

struct MyElement {
    style: StyleRefinement,
}

impl Styled for MyElement {
    fn style(&mut self) -> &mut StyleRefinement {
        &mut self.style
    }
}

fn render(...) {
    let bg_color = self.style.background;
    // Adjust bg_color ...

    div()
        .bg(default_color)
        .border_color(...)
        .map(|this| this.style().refine(&self.style))
}

So, I make a little change for Fill to split Solid and Background.

  • Solid: Mostly if we use bg(gpui::red()) the Solid will be used.
  • Background: For gradient background case.

And with color method to get the color from Fill.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants