Skip to content

Use gray and bright-white as the default dialog theme - #637

Merged
st0012 merged 1 commit into
masterfrom
default-to-black-and-white-theme
Feb 25, 2024
Merged

st0012 merged 1 commit into
masterfrom
default-to-black-and-white-theme

Conversation

@st0012

@st0012 st0012 commented Jan 27, 2024 •

Copy link
Copy Markdown
Member

I think this has a few benefits:

  1. Most terminal themes generally don't change or only pick similar colors for their black and white colors, so it's more likely to be consistent across terminals/themes.
  2. They don't have the potential color-blind issues that other color options may have.
  3. We won't need additional changes for no color mode.

@st0012 st0012 added the enhancement New feature or request label Jan 27, 2024
@hasumikin

Copy link
Copy Markdown
Contributor

I agree

@ima1zumi

Copy link
Copy Markdown
Member

I agree with changing the default dialog theme.

How about changing the default background color to gray?
In my environment, black looks the same color as the background because I set the same color to the background and black. It's hard to distinguish between the completion dialog and the input line.

The black background of Terminal.app's default theme was also the same color as the background and black, so I think some people will have the same problem.

black:

image

gray:

image

white background and gray:

image

@tompng

tompng commented Jan 28, 2024 •

Copy link
Copy Markdown
Member

I agree we should change cyan-white color to another one.

I think black and white have problem with terminal background color. Changing it will solve some problem but brings another problem.
(iTerm default, Alacritty default, and two preset dark theme in Terminal.app are black == terminal background color)

I think supporting NO_COLOR using almost no color by default is too much.
It's worth supporting NO_COLOR, but Emacs and Vim does not check NO_COLOR env, and this indicates that almost-no-color is not a good default for multiline editor.

I think using cyan-black is a good improvement with less impact/surprise of the change.
Before this commit, The color cyan-default is displayed cyan-black in bright theme.

Example of various terminals colors

colors
(Generated by https://gist.github.com/tompng/1d246f565ce662dfa74b3376f6215e27, color table from wikipedia seems a bit outdated...)
cyan-black has more contrast than cyan-white.
gray-black has more contrast than gray-white except Ubuntu Terminal(gray==black). Maybe we can use gray-bright_white.
white background can be distinguished from bright theme background because white is darker than bright_white.

@st0012

st0012 commented Feb 1, 2024

Copy link
Copy Markdown
Member Author

It's hard to distinguish between the completion dialog and the input line.

I think black and white have problem with terminal background color. Changing it will solve some problem but brings another problem.

I don't feel it's a big problem tbh. While it'd be better to have different colors between dialog and terminal background, using grey risks lowering contrast even further as shown in @tompng's example above.

Since some theme gems are built with matching background too (e.g. irb-theme-tokyonight), I think this may be less of an issue to users?

I think using cyan-black is a good improvement with less impact/surprise of the change.

I think Cyan is mostly used for highlighting. Since it's a light-ish color, using it as background hurts my eyes a bit too (not as bad as white would though). I also don't recall seeing any apps (terminal or not) using it as an UI's background (examples are welcome ofc)? So I don't think it's a good background color.

Sorry for sounding like a hard-to-please person 😅 Let me share my priority list in terms of issues:

  1. Colors having low contrast and making text hard to read
  2. Abnormal color combination
  3. Having same the dialog background the same as terminal background in dark terminals

So for this reason, I still prefer black-and-white theme as it addresses the first 2 issues.

@ima1zumi

ima1zumi commented Feb 2, 2024

Copy link
Copy Markdown
Member

Whichever color is chosen, it may be difficult to see due to the color set on the terminal emulator.
For me, having black and the background color the same color was more difficult to see than cyan. 😢

I thought it would be more versatile to use a style rather than a fixed color.
How about using style: faint to represent completion candidates? It cannot be mistaken for the line being input and can be used for any color schema.

Reline::Face.config(:completion_dialog) do |conf|
  conf.define :default, style: :faint
  conf.define :enhanced
  conf.define :scrollbar
end

If you have difficulty seeing the currently selected line, you may set :negative.

Reline::Face.config(:completion_dialog) do |conf|
  conf.define :default, style: :faint
  conf.define :enhanced, style: :negative
  conf.define :scrollbar
end

Only set faint

image
image
image
image

Set faint and negative

image
image
image
image

@tompng

tompng commented Feb 5, 2024

Copy link
Copy Markdown
Member

With singleline input, the problem of black background is not clear.
Here's a sample of multiline input and black-white terminal. Dialog is completely blend into the background.
multiline_black_dialog

This is the default color configuration of iTerm2, so I think we can't select black as default background.

@tompng

tompng commented Feb 5, 2024

Copy link
Copy Markdown
Member

Every combination have a tradeoff, and default color should have less problem in various points of view.
I think we have at least two constraints:

  • terminal background and dialog background should differ.
  • better contrast than cyan-white.

I don't think cyan is the best background, but I propose cyan-black because it's

  • Surely better than before. I think it's a good first aid.
  • Can even ship it as a bugfix (because it was cyan-default(black in bright theme) before)
  • Changing default color frequently is not good, but cyan-white to cyan-black then to another better color might be acceptable.

I'm also ok with any combination that satisfies these two constraints

@tompng

tompng commented Feb 10, 2024

Copy link
Copy Markdown
Member

I think we want these conditions:

  • Should avoid black and bright_white for every background and scrollbar foreground
  • Should have good contrast. Better contrast than gray-white or gray-black is preferred
  • Looks like grayscale(black gray white bright_white) is preferred by us

Considering it, I think possible color combinations are only few.

background foreground scrollbar-foreground enhanced background
white black gray gray or vivid colors
gray(=bright_black) bright_white white white or vivid colors

Sample of gray - bright_white
gray-bright_white

@st0012
st0012 force-pushed the default-to-black-and-white-theme branch from 8fb38aa to 77489ff Compare February 16, 2024 17:07
@st0012 st0012 changed the title Use black and white as the default dialog theme Use gray and bright-white as the default dialog theme Feb 16, 2024
@st0012

st0012 commented Feb 16, 2024

Copy link
Copy Markdown
Member Author

I've adopted bright-white and gray combination and updated the screenshots 👍

I think this has a few benefits:

1. Most terminal themes generally don't change or pick similar colors
   for their black and white colors, so it's more likely to be consistent
    across terminals/themes.
2. They don't have the potential color-blind issues that other color options
   may have.
3. We won't need additional changes for no color mode.
@st0012
st0012 force-pushed the default-to-black-and-white-theme branch from 77489ff to 83fcc13 Compare February 16, 2024 17:26
@tompng

tompng commented Feb 16, 2024

Copy link
Copy Markdown
Member

👍

I personally think that enhanced line can have color.
When there are only two candidates, colored enhanced line is more clear which one is selected now.
color_enhanced

It's only when candidates.size == 2, I think current black white enhanced line is also OK 😄

@st0012

st0012 commented Feb 16, 2024

Copy link
Copy Markdown
Member Author

To me the bright color + white combination is not comfortable to look at and was the reason I dislike the default colors. So while I understand the appeal I still prefer black and white.

@ima1zumi ima1zumi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's easy to read in various color schemes. 👍

@hasumikin hasumikin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there are only two candidates, colored enhanced line is more clear which one is selected now.

I would rather give importance to this opinion👆

But it's not a super big problem. I'm fine if you three are OK with the monochrome scheme

@st0012

st0012 commented Feb 19, 2024

Copy link
Copy Markdown
Member Author

How about we apply bold to the enhanced item as well?

Screen.Recording.2024-02-19.at.11.22.05.mov

(I also tried faint and italicized and I don't think they're good options)

@st0012

st0012 commented Feb 25, 2024

Copy link
Copy Markdown
Member Author

Ok, I'm merging and releasing this now. We can adjust the color/style further later if we received feedback on this.

@st0012
st0012 merged commit 6579a0a into master Feb 25, 2024
@st0012
st0012 deleted the default-to-black-and-white-theme branch February 25, 2024 07:08
matzbot pushed a commit to ruby/ruby that referenced this pull request Feb 25, 2024
(ruby/reline#637)

I think this has a few benefits:

1. Most terminal themes generally don't change or pick similar colors
   for their black and white colors, so it's more likely to be consistent
    across terminals/themes.
2. They don't have the potential color-blind issues that other color options
   may have.
3. We won't need additional changes for no color mode.

ruby/reline@6579a0a737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants