# editor: Improve text color in document color highlight \(\#39372\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d7ffc37b149e219eedde6398a2e9369fabc61e85)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d7ffc37b149e219eedde6398a2e9369fabc61e85

Requested commit: d7ffc37b149e219eedde6398a2e9369fabc61e85

Commit: d7ffc37b149e219eedde6398a2e9369fabc61e85

Tree: 736c782a290621dbb3428606f0c32fd163822497

Author: Jason Lee

Committer: GitHub

## Message

```
editor: Improve text color in document color highlight (#39372)

Release Notes:

- Improved text color in LSP document color highlight.

----

Because highlight ranges are implemented using a paint background,
there's no way to control the text color.

I've been thinking about this problem for a long time, want to solve it.

~~Today, I come up with a new idea. Re-rendering the document color text
at the top should solve this problem.~~

#### Update 10/6: 

> The previous version is not good, when we have soft wrap text, that
version will not work correct.

Now use exists `bg_segments_per_row` feature to fix text color.

## Before

<img width="563" height="540" alt="image"
src="https://github.com/user-attachments/assets/99722253-0cab-4d2a-a5d1-7f28393bcaed"
/>


## After

<img width="544" height="527" alt="image"
src="https://github.com/user-attachments/assets/a1bf6cdb-0e9c-435d-b14a-6ee9159a63d9"
/>
```

## Parents

- [b79837695e66b95b7e32790999b6f732e54cc7d1](https://git.cafe/gitcafe/zed/commit/b79837695e66b95b7e32790999b6f732e54cc7d1?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d7ffc37b149e219eedde6398a2e9369fabc61e85?format=markdown)
