bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.18k stars 3.47k forks source link

per edge border colors #14773

Open databasedav opened 1 month ago

databasedav commented 1 month ago

What problem does this solve or what need does it fill?

Like the web https://developer.mozilla.org/en-US/docs/Web/CSS/border-color, one should be able to specify separate colors for each side of a node's border.

What solution would you like?

struct BorderColor {
    pub top: Color,
    pub bottom: Color,
    pub left: Color,
    pub right: Color
}

What alternative(s) have you considered?

Coordinating overlapping nodes with selective borders, or using a shader.

Additional context

The canonical use case for this is reactively changing the border color when hovered over a particular edge to signal resizability.

alice-i-cecile commented 1 month ago

This was considered at the time, and the consensus was that this wasn't particularly useful or appealing. It complicates the API and costs performance for a pretty niche effect.

Can you say more about why you want this? What sort of application are you building, and what effect do you want to achieve?

databasedav commented 1 month ago

@alice-i-cecile I'm building a UI framework and an inspector on top of it, I wanted a built-in way to do the borders that bevy-inspector-egui has, I have a hacky approach in mind that will suffice, but I thought this was worth filing since I couldn't find other tracking for something like this

JMS55 commented 1 month ago

Could be done with a custom UiMaterial to avoid bloating the stand one.

ickshonpe commented 2 weeks ago

When I implemented the original borders PR I wanted to support colours per edge but the UI renderer then was very limited and couldn't draw trapezoids only rectangles so there wasn't any way to divide up the border into four different coloured sections. It should be trivial to add support now though.