Project

General

Profile

Actions

Feature #19010

closed

Follow up of #18996: Support changing irb's autocompletion background

Added by st0012 (Stan Lo) about 2 years ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:109949]

Description

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) for users to choose:

Theme:dark

Bright terminal - dark theme Dark terminal - dark theme

Theme :bright

Bright terminal - bright theme Dark terminal - bright theme

Default

In terms of default, I think dark is better than bright. Because when in a bright terminal, seeing a dark dropdown isn't so troubling. But when in a dark terminal, seeing a large bright 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), 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, we can expose the API as

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

IRB.conf[:USE_BRIGHT_THEME] = true

2. Per-color configurations

For users who want to configure individual colors, we should also provide options on the irb side, like

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.


Files

Screenshot_20220918_135231.png (70.8 KB) Screenshot_20220918_135231.png kaiquekandykoga (Kaíque Koga), 09/18/2022 05:01 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #18996: Proposal: Introduce new APIs to reline for changing dialog UI coloursClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0