Skip to content

Very simple fix for where linear gradient is used as a border between…#24846

Open
gagnus wants to merge 1 commit into
bevyengine:mainfrom
gagnus:feature-gradient-as-slider-interpolation-fix
Open

Very simple fix for where linear gradient is used as a border between…#24846
gagnus wants to merge 1 commit into
bevyengine:mainfrom
gagnus:feature-gradient-as-slider-interpolation-fix

Conversation

@gagnus

@gagnus gagnus commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

…, say, a slider and its background. Interpolating as SRGB involves a conversion in rust and conversion back in shader using different maths leading to slightly off colors, interpolating as linear is clean and produces exact results

Objective

  • Noticed that a slider with same BG color as the surrounding area still appeared slightly different, fixed by tracing through where the colors were coming from.

Solution

  • Changed interpolation to linear, which basically means there is no two way conversion

Showcase

Before (annotation text added afterwards, difference is probably only visible with an eyedropper tool)

image

…, say, a slider and its background. Interpolating as SRGB involves a conversion in rust and conversion back in shader using different maths leading to slightly off colors, interpolating as linear is clean and produces exact results

@ickshonpe ickshonpe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, nice practical solution.

We should look into the mismatch in the colour conversion code though and see if its accuracy can be improved. I'll add an issue.

@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 3, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Jul 3, 2026
@ickshonpe ickshonpe added D-Trivial Nice and easy! A great choice to get started with Bevy C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Jul 3, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Jul 3, 2026
@ickshonpe ickshonpe added the A-Color Color spaces and color math label Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Color Color spaces and color math A-Rendering Drawing game state to the screen A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage
Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

2 participants