Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Predictive IntelliSense's text color is inaccessible #3477

@Tyriar

Description

@Tyriar

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

N/A

Screenshot

cc @daxian-dbw @SteveL-MSFT

I just started seeing this feature described in #1468 and n noticed that it has hardcoded indexed color 238 (#444444), if you only set the foreground color to a fixed color it will have wildly varying levels of contrast depending on the terminal theme's background color, unless you also set the background color.

Prediction looks like it's regular input with #fff bg, #444 fg:

image

xterm.js' default demo theme is extremely low contrast, #2D2E2C bg, #F8F8F8 fg:

image

Prediction is invisible with #444 bg color:

image

I notice you can set the color manually via Set-PSReadLineOption -Colors @{ Prediction = '#8A0303'} but saying this is a good default and enough is a copout imo. Some users won't even know it's a feature because they can't see the text, and some users will think the shell is broken because it looks like regular text.

VS Code's minimum contrast feature actually prevents this contrast issue, however it brings another problem where it can more easily look like the default text color:

image

Considering this case, I think you should use the dim attribute by default to style the text while still allowing manual tweaking in psreadline options and in xterm.js we should exclude the dim attribute from the minimum contrast demands (or halve them).

Environment data

PS Version: 7.3.0
PS HostName: ConsoleHost
PSReadLine Version: 2.2.6
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 148
BufferHeight: 19

Steps to reproduce

Type git

Expected behavior

The prediction has reasonable contrast and is differentiated enough from the default foreground color, regardless of the terminal's background color.

Actual behavior

It can range from completely invisible to identical to the regular input.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions