Skip to content

ssh <start typing hostname> --- the hostname is invisible. No matter what color scheme I select. #14242

Closed as not planned

Description

Windows Terminal version

1.16.2642.0

Windows build number

10.0.22621.0

Other Software

No response

Steps to reproduce

Just open a windows terminal and issue a ssh command.

(also seen when I ran [environment]::OsVersion -- the [environment] part of the string is invisible)

Expected Behavior

Here is the copy/paste of what I typed into the terminal (and what came back when I hit enter)

PS C:\Users\migarret\Work Folders\Downloads> ssh imola1
Warning: Permanently added 'xx.xx.xx.xx' (ED25519) to the list of known hosts.
Last login: Mon Oct 17 15:20:33 2022 from xx.xx.xx.xx
AvereOS_2022.08.0

[root@imola1 ~]#

Actual Behavior

image

Activity

  1. added
    Issue-BugIt either shouldn't be doing this or needs an investigation.
    Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meeting
    on Oct 17, 2022
  2. DHowett commented on Oct 17, 2022

    @DHowett
    Member

    Huh. This might be an alternate reality version of this note, which applies to background colors (they're handled by the same code.)

    All the same, can you share your settings.json?

  3. DHowett commented on Oct 17, 2022

    @DHowett
    Member

    (And, perhaps, would you grab the following powershell output?

    $PSVersionTable
    
    Get-Module PSReadline | Format-List *
    
  4. 237dmitry commented on Oct 17, 2022

    @237dmitry

    The main trouble is in the PSReadline options and $PSStyle parameters that know nothing about colorschemes. Everything requires configuration.

    (also seen when I ran [environment]::OsVersion -- the [environment] part of the string is invisible)

    Select with the mouse or set it to the clipboard:

    $PSversionTable | Out-String | Set-Clipboard

    You can change default foreground color of PSReadline:

    Set-PSReadLineOption -Color @{'Default' = "`e[38;5;16m"}

    Screenshot 2022-10-18 000646

  5. DHowett commented on Oct 17, 2022

    @DHowett
    Member

    237dmitry you're right that it's configurable, but also... this text should be showing up in the "default foreground" color. I marked your original comments as off-topic since they may confuse users into thinking that to see text by default they would need to do some configuring. Still, I appreciate you adding additional info to this bug report!

    The default foreground and background in every color scheme should absolutely be readable and require no Terminal or shell configuration. 🙂

  6. 237dmitry commented on Oct 17, 2022

    @237dmitry

    this text should be showing up in the "default foreground"

    I think, PSReadline Team does not think about it. If you launch pwsh without profile pwsh -NoProfile and see output of Get-PSReadlineOptions there is:

    DefaultTokenColor                      : "`e[37m"    # White! 
    

    I do not know this parameter changes depend on base 16 colors or not. Rather not. This is static value -- user knows better how to tune host.

  7. DHowett commented on Oct 17, 2022

    @DHowett
    Member

    Ah, that's a very good point! The default configuration of PowerShell does display white-on-default-bg. Bah. Thank you!

  8. mgarrett69 commented on Oct 18, 2022

    @mgarrett69
    Author
    Name                           Value                                                                                                                                         
    ----                           -----                                                                                                                                         
    PSVersion                      5.1.22621.608                                                                                                                                 
    PSEdition                      Desktop                                                                                                                                       
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                       
    BuildVersion                   10.0.22621.608                                                                                                                                
    CLRVersion                     4.0.30319.42000                                                                                                                               
    WSManStackVersion              3.0                                                                                                                                           
    PSRemotingProtocolVersion      2.3                                                                                                                                           
    SerializationVersion           1.1.0.1                       
    
    PS C:\Users\migarret\Work Folders\Downloads> Get-Module PSReadline | Format-List *
    
    
    LogPipelineExecutionDetails : False
    Name                        : PSReadLine
    Path                        : C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0\PSReadLine.psm1
    ImplementingAssembly        :
    Definition                  : function PSConsoleHostReadLine
                                  {
                                      Microsoft.PowerShell.Core\Set-StrictMode -Off
                                      [Microsoft.PowerShell.PSConsoleReadLine]::ReadLine($host.Runspace, $ExecutionContext)
                                  }
    
    Description                 : Great command line editing in the PowerShell console host
    Guid                        : 5714753b-2afd-4492-a5fd-01d9e2cff8b5
    HelpInfoUri                 : https://aka.ms/powershell51-help
    ModuleBase                  : C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0
    PrivateData                 :
    Tags                        : {}
    ProjectUri                  :
    IconUri                     :
    LicenseUri                  :
    ReleaseNotes                :
    RepositorySourceLocation    :
    Version                     : 2.0.0
    ModuleType                  : Script
    Author                      : Microsoft Corporation
    AccessMode                  : ReadWrite
    ClrVersion                  : 4.0.0
    CompanyName                 : Microsoft Corporation
    Copyright                   : (c) Microsoft Corporation. All rights reserved.
    DotNetFrameworkVersion      : 4.6.1
    ExportedFunctions           : {[PSConsoleHostReadLine, PSConsoleHostReadLine]}
    Prefix                      :
    ExportedCmdlets             : {[Get-PSReadLineKeyHandler, Get-PSReadLineKeyHandler], [Get-PSReadLineOption, Get-PSReadLineOption], [Remove-PSReadLineKeyHandler,
                                  Remove-PSReadLineKeyHandler], [Set-PSReadLineKeyHandler, Set-PSReadLineKeyHandler]...}
    ExportedCommands            : {[Get-PSReadLineKeyHandler, Get-PSReadLineKeyHandler], [Get-PSReadLineOption, Get-PSReadLineOption], [Remove-PSReadLineKeyHandler,
                                  Remove-PSReadLineKeyHandler], [Set-PSReadLineKeyHandler, Set-PSReadLineKeyHandler]...}
    FileList                    : {}
    CompatiblePSEditions        : {}
    ModuleList                  : {}
    NestedModules               : {Microsoft.PowerShell.PSReadLine}
    PowerShellHostName          :
    PowerShellHostVersion       :
    PowerShellVersion           : 5.0
    ProcessorArchitecture       : None
    Scripts                     : {}
    RequiredAssemblies          : {}
    RequiredModules             : {}
    RootModule                  : PSReadLine.psm1
    ExportedVariables           : {}
    ExportedAliases             : {}
    ExportedWorkflows           : {}
    ExportedDscResources        : {}
    SessionState                : System.Management.Automation.SessionState
    OnRemove                    :
    ExportedFormatFiles         : {C:\Program Files\WindowsPowerShell\Modules\PSReadLine\2.0.0\PSReadLine.format.ps1xml}
    ExportedTypeFiles           : {}
    

    settings.zip

  9. ghost added
    Needs-AttentionThe core contributors need to come back around and look at this ASAP.
    on Oct 18, 2022
  10. ghost removed
    Needs-Author-FeedbackThe original author of the issue/PR needs to come back and respond to something
    on Oct 18, 2022
  11. mgarrett69 commented on Oct 18, 2022

    @mgarrett69
    Author
    PS C:\Users\migarret\Work Folders\Downloads> Get-PSReadlineOptions
    Get-PSReadlineOptions : The term 'Get-PSReadlineOptions' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
    name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + Get-PSReadlineOptions
    + ~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Get-PSReadlineOptions:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    
    PS C:\Users\migarret\Work Folders\Downloads> Set-PSReadLineOption -Color @{'Default' = "`e[38;5;16m"}
    Set-PSReadLineOption : 'e[38;5;16m' is not a valid color value.  It must be a ConsoleColor, ANSI escape sequence, or RGB value with optional leading '#'.
    At line:1 char:1
    + Set-PSReadLineOption -Color @{'Default' = "`e[38;5;16m"}
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Set-PSReadLineOption], ArgumentException
        + FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.SetPSReadLineOption
    
    
  12. mgarrett69 commented on Oct 18, 2022

    @mgarrett69
    Author

    Let me know if I missed any of the output you wanted. As you can see, I caught errors when trying a few of the suggestions above.

    And, for what it's worth, my background is grey, so even white lettering should not be invisible,,, I think.

  13. elsaco commented on Oct 19, 2022

    @elsaco

    Mike Garrett (@mgarrett69) it's Get-PSReadLineOption not Get-PSReadLineOptions

  14. mgarrett69 commented on Oct 20, 2022

    @mgarrett69
    Author

    Thanks elsaco

    PS C:\Users\migarret\Work Folders\Downloads> Get-PSReadLineOption

    EditMode : Windows
    AddToHistoryHandler : System.Func`2[System.String,System.Object]
    HistoryNoDuplicates : True
    HistorySavePath : C:\Users\migarret\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
    HistorySaveStyle : SaveIncrementally
    HistorySearchCaseSensitive : False
    HistorySearchCursorMovesToEnd : False
    MaximumHistoryCount : 4096
    ContinuationPrompt : >>
    ExtraPromptLineCount : 0
    PromptText : {> }
    BellStyle : Audible
    DingDuration : 50
    DingTone : 1221
    CommandsToValidateScriptBlockArguments : {ForEach-Object, %, Invoke-Command, icm...}
    CommandValidationHandler :
    CompletionQueryItems : 100
    MaximumKillRingCount : 10
    ShowToolTips : True
    ViModeIndicator : None
    WordDelimiters : ;:,.[]{}()/|^&*-=+'"–—―
    AnsiEscapeTimeout : 100
    CommandColor : "$([char]0x1b)[93m"
    CommentColor : "$([char]0x1b)[32m"
    ContinuationPromptColor : "$([char]0x1b)[37m"
    DefaultTokenColor : "$([char]0x1b)[37m"
    EmphasisColor : "$([char]0x1b)[96m"
    ErrorColor : "$([char]0x1b)[91m"
    KeywordColor : "$([char]0x1b)[92m"
    MemberColor : "$([char]0x1b)[97m"
    NumberColor : "$([char]0x1b)[97m"
    OperatorColor : "$([char]0x1b)[90m"
    ParameterColor : "$([char]0x1b)[90m"
    SelectionColor : "$([char]0x1b)[30;47m"
    StringColor : "$([char]0x1b)[36m"
    TypeColor : "$([char]0x1b)[37m"
    VariableColor : "$([char]0x1b)[92m"

  15. DHowett commented on Oct 20, 2022

    @DHowett
    Member

    Alright, so the root cause for this one is that the white color¹ in your default color scheme, Campbell, is set to the same color as the background. Now, you told me that this worked before Terminal 1.15 . . . and I'll get to that.

    Anyway, PowerShell is explicitly requesting white and it doesn't know that your background is also white. Crap.

    We've got a couple ways around this.

    One is this feature that's currently available in preview builds that automatically detects when two colors have poor (or even catastrophic!) contrast and darkens or lightens the foreground color as appropriate to make it visible. Eventually, we'll enable it by default. That re-landed in #13343 and was enhanced in #13512.

    The other is for you to change the white color (and bright white) to be dark; effectively, make a flipped version of the Campbell scheme where white and black are actually swapped.

    ¹ that is, color 37. you can see in your PSReadlineOptions that DefaultTokenColor is (blah blah blah) **37** m 

    ² why it's asking for 37 is... a long and ultimately disappointing story. The console only used to support 16 colors but all terminals since, say, 1981 have supported 18. PowerShell used the tools available to them and declared the "default" token color to be "white" (rather than "let the terminal decide what is best for visibility")


    Now for the kicker. This worked in Terminal 1.14 (actually, this worked in all versions of Terminal between 0.1 (inclusive) and 1.15 (exclusive)!) In 1.15, however, we tore off in PR #13352 a band-aid that we had previously applied to PowerShell (originally applied in #6810).

    Well, that band-aid was fixing two problems. One, the actual problem. Two, this.

    We expressly ignored any requests for CSI 40 (black background) and CSI 37 (white foreground) from PowerShell... because they used it erroneously all the time.

    In so doing, we hid this issue where their default token color is, in fact, 37. It should be 39.

    Now that we're respecting PowerShell's color choices again, we're bound to run into more cases like this.


    Mike Garrett (@mgarrett69) realized that he never tested other color schemes because of our poor and confusing UI for selecting/editing them. 1.16 didn't do so much to help, because the buttons that make it clear that there's actions to take are "below the fold." We should keep ideating there.


    Tagged for team discussion so we can assess:

    • reintroducing the color quirk
    • enabling "color nudging" by default again
    • what to do about the color schemes UI
  16. zadjii-msft commented on Oct 25, 2022

    @zadjii-msft
    Member

    We talked more with the PsReadline folks today. overall, we felt like the best option wasn't to keep patching an edge case with more heuristics. That would just shift the dissatisfaction around to different users in an elaborate game of wack-a-mole. They acknowledged that yea, the default PsReadline settings aren't configured for a light scheme, they're set up for a dark scheme (for more historical context: PowerShell/PSReadLine#464). They're gonna go ahead and update their docs to better clarify that users who prefer a light scheme should change their PsReadLine settings to match. That's tracked in: MicrosoftDocs/PowerShell-Docs#9358

    As an immediate workaround, you should be able to set "adjustIndistinguishableColors": "indexed" to force the Terminal to manually adjust the text colors to ensure there's enough contrast in this use case.

  17. added
    Resolution-AnsweredRelated to questions that have been answered
    and removed
    Needs-AttentionThe core contributors need to come back around and look at this ASAP.
    on Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugIt either shouldn't be doing this or needs an investigation.Issue-QuestionFor questions or discussionNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meetingResolution-AnsweredRelated to questions that have been answered

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions