Feature #19010
Updated by st0012 (Stan Lo) about 2 years ago
If the APIs proposed in #18996 (or similar ones) are accepted, we'll be able to configure `irb`'s autocompletion dialog colors. And for the `irb` side, I want to propose 2 levels of configurations: #### TL;DR - Have `dark`/`bright` themes in `irb` - Use `dark` theme by default because a bright dropdown in dark background is more uncomfortable to read than a dark dropdown in bright background. - `irb` will pass per-colour configuration to `reline` too. So users can still configure individual colours if they want to. ### 1. Theme selection Consider most users don't care about individual colors if the text are readable and roughly match with the terminal background, I want to provide 2 basic themes (dark/bright) (dark/light) for users to choose: **Theme`:dark`** <img width="40%" alt="Bright alt="Light terminal - dark theme" src="https://user-images.githubusercontent.com/5079556/180603528-8a8b60d1-6a1e-4be8-9c18-5e73cae7a24c.png"> <img width="40%" alt="Dark terminal - dark theme" src="https://user-images.githubusercontent.com/5079556/180603526-3618f181-fff3-45c5-b925-061110366adf.png"> **Theme `:bright`** `:light`** <img width="40%" alt="Bright alt="Light terminal - bright light theme" src="https://user-images.githubusercontent.com/5079556/180603529-0d8a24af-3d93-4573-afbd-0d354b3145cc.png"> <img width="40%" alt="Dark terminal - bright light theme" src="https://user-images.githubusercontent.com/5079556/180603527-4d0fcbf7-fbd5-4099-ac78-9236f8b8c782.png"> **Default** In terms of default, I think `dark` is better than `bright`. `light`. Because when in a bright light terminal, seeing a dark dropdown isn't so troubling. But when in a dark terminal, seeing a large bright light dropdown can bring discomfort to eyes. Side note: It's possible to detect the terminal's background color from an xterm-compatible terminal emulator ([example gist](https://gist.github.com/blueyed/c8470c2aad3381c33ea3)), so `irb` may automatically assign themes based on users' terminal theme. But we still need to pick a default as the fallback. **Interface for theme selection** If we think it's possible to introduce more themes than just dark/bright, dark/light, we can expose the API as ```rb IRB.conf[:DIALOG_THEME] = theme_name ``` If we don't consider introducing other themes, we can make it a toggle for the non-default theme, like ```rb IRB.conf[:USE_BRIGHT_THEME] IRB.conf[:USE_LIGHT_THEME] = true ``` ### 2. Per-color configurations For users who want to configure individual colors, we should also provide options on the `irb` side, like ```rb IRB.conf[:dialog_default_bg_color] = :black ``` This prevents directly exposing `reline`'s API to normal `irb` users. **I implemented the ideas in this [proof of concept PR](https://github.com/ruby/irb/pull/380).**