Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal only offers 8 bit color #193562

Closed
lunndal opened this issue Sep 20, 2023 · 11 comments
Closed

Terminal only offers 8 bit color #193562

lunndal opened this issue Sep 20, 2023 · 11 comments
Assignees
Labels
info-needed Issue requires more information from poster terminal-rendering

Comments

@lunndal
Copy link

lunndal commented Sep 20, 2023

Type: Bug

When I disable or uninstall the PowerShell extension, choose any PowerShell Terminal Default Profile and restart VS Code, the terminal only displays 8 bit color when running the supplied test script. When running the same script in the Windows PowerShell terminal, outside of VS Code, the result is as expected.

Edit: I'm running VS Code and the external PowerShell window inside a Remote Desktop session. It does not seem to matter for the external window, but maybe it bears an impact on how VS Code handles colors?

Colors in use

$ wmic path Win32_VideoController get VideoModeDescription
VideoModeDescription
1250 x 1188 x 4294967296 colors

(Edit2: Screenshot corrected. Thanks @Tyriar)
image

Code to test

$esc = "$([char]0x1b)"
$out = (232..255) | ForEach-Object { "$esc[48;5;$($_)m $esc[0m" }
$out -join ""

settings.json

{
    "http.proxy": "http://aaa.bbb.ccc:NNNN",
    "http.proxyAuthorization": null,
    "http.proxyStrictSSL": false,
    "editor.minimap.enabled": false,
    "terminal.integrated.tabs.enabled": false,
    "terminal.integrated.enableMultiLinePasteWarning": true,
    "terminal.integrated.localEchoStyle": "dim",
    "workbench.colorTheme": "Visual Studio Dark",
    "terminal.integrated.minimumContrastRatio": 1,
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        },
        "Windows PowerShell": {
            "path": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
        }
    },
    "terminal.integrated.defaultProfile.windows": "PowerShell",
    "terminal.integrated.gpuAcceleration": "off"
}

VS Code version: Code 1.82.2 (abd2f3d, 2023-09-14T05:55:25.390Z)
OS version: Windows_NT x64 10.0.17763
Modes:

System Info
Item Value
CPUs Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz (2 x 2594)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: disabled_off
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software
Load (avg) undefined
Memory (System) 8.00GB (1.61GB free)
Process Argv --crash-reporter-id a9d6709a-eae5-4b26-98ad-c63feee23ee3
Screen Reader no
VM 100%
Extensions (2)
Extension Author (truncated) Version
xml Dot 2.5.1
markdown-all-in-one yzh 3.5.1
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30792226
vsclangdf:30486550
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
f6dab269:30613381
2i9eh265:30646982
showlangstatbar:30737416
0bi6i642:30841073
03d35959:30757346
7ij38806:30736111
pythonfmttext:30731395
9b8hh234:30694863
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
copilotsettingc:30839828
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015:30829745

@Tyriar
Copy link
Member

Tyriar commented Sep 20, 2023

The screenshot shows you're using the PowerShell extension here, not a regular powershell terminal. Does it all work fine if you create it using standard pwsh?

image

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Sep 20, 2023
@lunndal
Copy link
Author

lunndal commented Sep 21, 2023

The screenshot shows you're using the PowerShell extension here, not a regular powershell terminal. Does it all work fine if you create it using standard pwsh?

Thanks for taking the time to reply. I seem to have attached the wrong screenshot. As mentioned I disabled the PowerShell Extension and the result comes out the same with or without the extension. I have updated the original post.

Edit: I'm running VS Code and the external PowerShell window inside a Remote Desktop session. It does not seem to matter for the external window, but maybe it bears an impact on how VS Code handles colors?

Colors in use

$ wmic path Win32_VideoController get VideoModeDescription
VideoModeDescription
1250 x 1188 x 4294967296 colors

Here is the correct screenshot:
image

@Tyriar
Copy link
Member

Tyriar commented Sep 21, 2023

@lunndal could you try enabling trace logging and get the Terminal log when you run this command? That will tell us what pwsh (or conpty) is telling us to print to see if it's an upstream issue or not.

@lunndal
Copy link
Author

lunndal commented Sep 21, 2023

Sure thing!

terminal.log

@Tyriar
Copy link
Member

Tyriar commented Sep 21, 2023

I see this line:

2023-09-21 14:37:55.521 [debug] [15782cd] parsing data "  �[0;37;40;100m              �[0;37;47;8m      �[0;7m  �[0m�[0K�[?25l

This ends up running essentially this:

Write-Host "  `e[0;37;40;100m              `e[0;37;47;8m      `e[0;7m  `e[0m"

image

I was just writing up a detailed explanation of how to look into this but then I realized you're on an old version of Windows 10. Unfortunately that version of Windows does not ship conpty which is the new, much improved pty emulator developed by the Windows Terminal team:

image

You will need up upgrade Windows to fix this as we depend on the OS component.

@Tyriar Tyriar closed this as completed Sep 21, 2023
@lunndal
Copy link
Author

lunndal commented Sep 21, 2023

There might be some misunderstanding here. I'm on Windows Server 2019 Standard (10.0.17763 Build 17763), as the screenshot in the OP shows. Also, in the screenshot you can see that the Windows PS Terminal in the OS, outside of VS Code, does not have this problem.

@Tyriar
Copy link
Member

Tyriar commented Sep 21, 2023

@lunndal that's expected, it works in Windows Terminal because they ship their own version of conpty in product, separate to the one distributed with Windows. We would like to do the same but they don't ship a package yet that we can embed (tracked in microsoft/node-pty#490)

@lunndal
Copy link
Author

lunndal commented Sep 21, 2023

@Tyriar I see. But is conpty enabled terminal supported in VS Code on Windows Server 2019 Standard (10.0.17763 Build 17763), as I am running?

@Tyriar
Copy link
Member

Tyriar commented Sep 21, 2023

@lunndal it's only available in build 18309+, and that's also quite an old version as this point

@lunndal
Copy link
Author

lunndal commented Sep 22, 2023

EDIT: Tested and working on 2022. Thanks again for your help!

One last question before I let you go, @Tyriar :

Is this feature supported on Server 2022 LTSB?

@Tyriar
Copy link
Member

Tyriar commented Sep 25, 2023

@lunndal I'm not too familiar with Windows Server, typically it's based on the build number of Windows, so if that version is above 18309 I would expect it to work.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster terminal-rendering
Projects
None yet
Development

No branches or pull requests

3 participants