ZIm/crates/repl/src
Richard Feldman 9b7632d5f6
Automatically adjust ANSI color contrast (#34033)
Closes #33253 in a way that doesn't regress #32175 - namely,
automatically adjusts the contrast between the foreground and background
text in the terminal such that it's above a certain threshold. The
threshold is configurable in settings, and can be set to 0 to turn off
this feature and use exactly the colors the theme specifies even if they
are illegible.

## One Light Theme Before
<img width="220" alt="Screenshot 2025-07-07 at 6 00 47 PM"
src="https://github.com/user-attachments/assets/096754a6-f79f-4fea-a86e-cb7b8ff45d60"
/>

(Last row is highlighted because otherwise the text is unreadable; the
foreground and background are the same color.)

## One Light Theme After

(This is with the new default contrast adjustment setting.)

<img width="215" alt="Screenshot 2025-07-07 at 6 22 02 PM"
src="https://github.com/user-attachments/assets/b082fefe-76f5-4231-b704-ff387983a3cb"
/>

This approach was inspired by @mitchellh's use of automatic contrast
adjustment in [Ghostty](https://ghostty.org/) - thanks, Mitchell! The
main difference is that we're using APCA's formula instead of WCAG for
[these
reasons](https://khan-tw.medium.com/wcag2-are-you-still-using-it-ui-contrast-visibility-standard-readability-contrast-f34eb73e89ee).

Release Notes:

- Added automatic dynamic contrast adjustment for terminal foreground
and background colors
2025-07-07 22:39:11 +00:00
..
components chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
kernels python: Re-land usage of source file path in toolchain picker (#31893) 2025-06-02 16:29:06 +00:00
notebook gpui: Add shadow_xs, shadow_2xs and fix shadow values to match Tailwind CSS (#33361) 2025-07-03 09:50:26 -03:00
outputs Automatically adjust ANSI color contrast (#34033) 2025-07-07 22:39:11 +00:00
components.rs Show kernel options in a picker (#20274) 2024-11-07 17:59:53 -08:00
jupyter_settings.rs VSCode Settings import (#29018) 2025-04-23 20:54:09 +00:00
notebook.rs Initial Notebook UI structure (#19756) 2024-10-29 11:30:07 -07:00
outputs.rs Add horizontal scroll to REPL outputs (#33247) 2025-06-24 10:15:20 +03:00
repl.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
repl_editor.rs Add kernel detection for language support of runnable markdown cells (#29664) 2025-05-21 20:23:05 -07:00
repl_sessions_ui.rs gpui: Store action documentation (#33809) 2025-07-02 21:14:33 -04:00
repl_store.rs Add kernel detection for language support of runnable markdown cells (#29664) 2025-05-21 20:23:05 -07:00
session.rs Remove into SelectionEffects from .change_selections (#33554) 2025-06-27 14:31:31 -06:00