Skip to content

Improve text rendering in light mode - #7290

Merged
emilk merged 4 commits into
mainfrom
emilk/improve-light-mode-text
Jul 2, 2025
Merged

emilk merged 4 commits into
mainfrom
emilk/improve-light-mode-text

Conversation

@emilk

@emilk emilk commented Jul 2, 2025

Copy link
Copy Markdown
Owner

This changes how we convert glyph coverage to alpha (and ultimately a color), but only in light mode.

This is a bit of a hack, because it doesn't fix dark-on-light text in dark mode (if you have any), but for the common case this PR is a huge improvement.

You can also tweak this yourself now using Visuals::text_alpha_from_coverage or from the UI (bottom of the image):

image

Before / After

widget_gallery_light_x1 widget_gallery_light_x1

Black text Before/after

If you think the text above looks too weak, it's only because of the default text color. Here's how it looks like with perfectly #000000 black text:

image Screenshot 2025-07-02 at 13 59 30

@emilk emilk added visuals Renderings / graphics releated egui style visuals and theming labels Jul 2, 2025
@github-actions

github-actions Bot commented Jul 2, 2025

Copy link
Copy Markdown

Preview available at https://egui-pr-preview.github.io/pr/7290-emilkimprove-light-mode-text
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@emilk
emilk marked this pull request as ready for review July 2, 2025 12:00
@emilk
emilk requested a review from Wumpf as a code owner July 2, 2025 12:00

@Wumpf Wumpf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If nothing else it's now a lot easier to understand what's happening and why, nice!!

Tested the looks on low-dpi SDR Windows Firefox: I found the default settings a tad bit too light, empirically a gamma of 0.9 looked a lil bit better to me. But this is starting to get arbitrary so if you think linear looks good I'm very much in favor with sticking with that
Either way I also believe this to be an improvement compared the harsh and fringy looking boundaries of TwoCoverageMinusCoverageSq

Comment thread crates/epaint/src/image.rs Outdated
Comment thread crates/epaint/src/image.rs
@emilk
emilk merged commit dc79998 into main Jul 2, 2025
@emilk
emilk deleted the emilk/improve-light-mode-text branch July 2, 2025 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

egui style visuals and theming visuals Renderings / graphics releated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants