zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.26k stars 3.09k forks source link

Dark Text on Light Background is Rendered Weirdly #19100

Open SnoutBug opened 1 month ago

SnoutBug commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I wondered why all light themes look terrible in Zed. They look washed out, and in general have less contrast than their dark theme counter-part. I looked around in other editors and found that the fonts in zed seem to be rendered differently compared to elsewhere on my system. The issue is best shown by the screenshots below.

Environment

System Details Report
## Report details
- **Date generated:**                              2024-10-11 23:12:17
## Hardware Information:
- **Hardware Model:**                              Micro-Star International Co., Ltd MS-7B86
- **Memory:**                                      16,0 GiB
- **Processor:**                                   AMD Ryzen™ 5 2600 × 12
- **Graphics:**                                    AMD Radeon™ RX 7900 XT
## Software Information:
- **OS Name:**                                     Fedora Linux 40 (Workstation Edition)
- **OS Type:**                                     64-bit
- **GNOME Version:**                               46
- **Windowing System:**                            Wayland
- **Kernel Version:**                              Linux 6.10.12-200.fc40.x86_64
Zed system specs
Zed: v0.156.1 (Zed)
OS: Linux Wayland fedora 40
Memory: 15.5 GiB
Architecture: x86_64
GPU: AMD Radeon RX 7900 XT (RADV NAVI31) || radv || Mesa 24.1.7

If applicable, add mockups / screenshots to help explain present your vision of the feature

Zed Gnome Editor
image image
image image

Both Zed and the Gnome Editor use the same color scheme for dark and light mode. Notice how the light scheme in Zed looks drastically different (font appears thinner, more washed out and has seems to have less contrast) to the light theme in the Gnome Editor, or even the dark theme in Zed.

If applicable, attach your Zed.log file to this issue.

Zed.log


notpeter commented 1 month ago

This is similar to:

Can you see if the workaround suggested there improve things?

Also please paste your zed environment info into the description. (ctrl-shift-p, "zed: copy system specs to clipboard")

SnoutBug commented 1 month ago

The issue itself does not seem to be related, though it seems yioannides has had the same issue I face. The mentioned fix with the environment variables did not help, however. Changing the font itself also did not work.

yioannides commented 1 month ago

Yeah, the environment variable trick improves some of GNOME-wide aliasing issues, but Zed (literally) renders the font "wrong" in dark mode and I think it also affects both UI and monospace fonts used in Zed.

yioannides commented 1 month ago

UPDATE: While working on another unrelated issue, I removed the TTF version of Jetbrains and installed the OTF version instead, and the font surprisingly renders correctly:

image image

SnoutBug commented 1 month ago

Interestingly this did not help in my case. The light theme font still looks way thinner than the dark theme counterpart. For me a workaround would be to increase the font-weight for the light theme by 100 relative to the corresponding dark theme.

nirfse commented 2 weeks ago

I experience the same issue on Arch Linux with SwayWM, and zed-preview-bin with any monospace font (ttf-jetbrains-mono in my case). Dark mode themes have somewhat contrast font rendering, while light themes produce thin squishy font lines, as if there's some anti-aliasing or char thickness rendering issue. Manually increasing buffer_font_weight adds some contrast, but font rendering is still very off (OP's screenshots are on point).

meocoder31099 commented 2 weeks ago

This is an issue that prevents me from using Zed for my daily work. The text display on Zed is very poor compared to other text editing tools. I believe that having a good text display is an important aspect that should be prioritized in any text editor. It's unfortunate that this problem has persisted for a long time and has not been addressed.

scottpashley commented 2 weeks ago

I'm using the JetBrains mono fonts, I removed them all and then re-installed only the Semibold variant, which is what I use everywhere anyway. I went with the OTF version as suggested by @yioannides ~and now it looks as it should.~

Edit: after a while using this, "looks as it should" probably isn't quite accurate. It does look better, but actually, the same config with a dark theme does still look better somehow (the font appears slightly bolder)