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
46.91k stars 2.69k forks source link

[Accessibility] Alternative display style for editor.document_highlight.read_background #16380

Open thataboy opened 4 weeks ago

thataboy commented 4 weeks ago

Check for existing issues

Describe the feature

AFAIK, the only way to change appearance of dynamic bracket highlighting is with editor.document_highlight.read_background. This value is very dim by default in most themes, but regardless, changing the background color of a single character does not make it stand out very much. You don't want to go overboard since making it too bright only reduce contrast. Plus this color is also used to highlight words matching the one under the cursor and it would get too distracting.

Screenshot 2024-08-14 at 9 12 32 AM

I request another option to using the background color for this purpose, such as combination of different foreground color, style, and/or drawing a line beneath. Sublimetext does all of that as shown here

Screenshot 2024-08-14 at 9 13 17 AM

This is very clear and also looks nice (IMO). Obviously people with better eyes than mine will choose less bright colors, but I think this is an accessibility feature that will benefit everyone

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

No response

notpeter commented 4 weeks ago

I see. So you're wanting support for font_style on things like editor.document_highlight.read_background which currently only support a hex color string. We already support this for syntax elements, so it's not too crazy. For example you can easily make comments italic using theme overides:

  "experimental.theme_overrides": {
    "syntax": {
      "comment": {
        "color": "#afabb1ff",
        "font_style": "italic"
      }
    }
  },
Screenshot 2024-08-16 at 17 04 43
thataboy commented 3 weeks ago

I see. So you're wanting support for font_style on things like editor.document_highlight.read_background which currently only support a hex color string. We already support this for syntax elements, so it's not too crazy. For example you can easily make comments italicKeAFJFCWPmAsik9E42KF2Ni9EoZ_AVrTE">

Yes, so instead of editor.document_highlight.read_background, we could have

"editor.document_highlight.read.style" = {
   "background": null,
   "foreground": "#f0f000",
   "font_style": "italic",
   "font_weight": 700  
}

Or maybe it'd make more sense as part of the syntax? I don't know

"syntax": {
   "punctuation.bracket": {
       "color": "#f0f033",
       "font_style": null,
       "font_weight": null
   },
   "punctuation.bracket.highlight": {
       "color": "#f00000",
       "font_style": "italic",
       "font_weight": 700
   },
}