Feature #18996
closedProposal: Introduce new APIs to reline for changing dialog UI colours
Description
TL;DR¶
I want to add APIs to reline for changing its dialog item's colors.
The APIs I want to add actually have been merged but becaue:
- This is a design change
- The maintainer @aycabta (aycabta .) is not available to approve nor reject them
I want to raise it here to decide if we should:
- Drop them
- Modify them
- Officiallty accept them
Background¶
After version 1.4, irb provides autocompletion support, which is a great feature and has increased many developers' productivity significantly.
But there's an user-experience issue: the completion items' UI colors (set in reline) are not configurable. So depending on the user's terminal theme, some may find it hard to use because the background and the text having low-contrast colors, like this:

And if that happens, the user has no way to fix it. This caused users to open issues like:
for being able to change it.
Some users even decided to disable it completely because the colors are unreadable to them. I have also seen people sharingtips for disabling this feature: example. So I believe it may be bothering many developers.
Personally I really like this feature but the background also bothers me:

And that's why I want to improve it by making the colors configurable and potentially also by providing simple light/dark themes from irb.
Proposal¶
For the dialog UI, there are 2 element states: highlighted and default. In irb's case, the selected completion candidate will be highlighted, and the rest of options will be default. And each state has 2 colors: foreground (text) and background (block).
This means the reline should allow irb and/or users to configure:
- Default items' foreground color
- Default items' background color
- Highlighted items' foreground color
- Highlighted items' background color
That brings us to these APIs:
Reline.dialog_default_fg_colorReline.dialog_default_bg_colorReline.dialog_highlight_fg_colorReline.dialog_highlight_bg_color
And because reline only supports coloring through ANSI sequences, these APIs only has 8 available colors if we exclude their bright variants:
- Black
- Red
- Green
- Yellow
- Blue
- Magenta
- Cyan
- White
Given the limited options and also to prevent users from entering non-color ANSI sequences, these APIs only take color names directly:
- :black
- :red
- :green
- :yellow
- :blue
- :magenta
- :cyan
- :white
Example:
Reline.dialog_default_bg_color = :black
puts Reline.dialog_default_bg_color_sequence #=> 40
Reline.dialog_default_fg_color = :white
puts Reline.dialog_default_fg_color_sequence #=> 37
Reline.dialog_highlight_bg_color = :blue
puts Reline.dialog_highlight_bg_color_sequence #=> 34
Reline.dialog_highlight_fg_color = :black
puts Reline.dialog_highlight_fg_color_sequence #=> 30
I have made a proof of concept PR on irb to show what these APIs can achieve if they or similar ones are adopted.
Related PRs¶
The related changes are made through multiple PRs:
Other Thoughts¶
This is more of a concern on the irb part, but to make the UI looks comfortable, I think it's better to follow these conditions:
- An item's foreground and background colors should have high contrast with each other so the texts (foreground) are readable.
- For the
highlighteditem, its background color should be easily distinguishable from the rest ofdefaultitems. - When using dark terminal themes, the
defaultitems' background is better to be dark as well.
Files

