Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How do I change the default colors in a console? #12061

Closed
vefatica opened this issue Dec 28, 2021 · 19 comments
Closed

How do I change the default colors in a console? #12061

vefatica opened this issue Dec 28, 2021 · 19 comments
Labels
Issue-Question For questions or discussion Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Answered Related to questions that have been answered

Comments

@vefatica
Copy link

In a CMD console, with white text (37) on a black background (40), I can issue color 70 (black on white) and existing white text becomes black and the background of the whole window becomes white. But my prompt ends with ^[[0m and that seems to restore white on black. How can I change the defaults (in particular, what ^[[0m means)? Thanks.

Microsoft Windows 10 Pro for Workstations
10.0.19044.1415 (2009, 21H2)

image

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Dec 28, 2021
@237dmitry
Copy link

color 07

@vefatica
Copy link
Author

I don't understand. Color 07 is the default when CMD is started. I want to change that to 70. But ^[[0m keeps changing it back to 07.

@237dmitry
Copy link

Black on white: prompt $e[30;1;47;1m$s$p$g$s
White on black: prompt $e[37;0;40;0m$s$p$g$s

In registry (example of mine):

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"AutoRun"="prompt $E[38;2;100;150;100m$P$S$E[38;2;100;200;100m$G$S$E[0m"

And, this is for "dark" terminal color scheme.

@vefatica
Copy link
Author

I want to change the default colors and I want ^[[0m to use the new default colors.

@237dmitry
Copy link

I want to change the default colors

In a CMD console

Change color settings in console window preferences.

^[[0m

This end of escape-sequences -- reset to default

ANSI Escape Sequences

@vefatica
Copy link
Author

I want to change the default for only the current console. I want ^[[0m to have a new meaning for only the current console.

@237dmitry
Copy link

237dmitry commented Dec 28, 2021

1

2

@vefatica
Copy link
Author

^[[0m stilll means white on black.

image

image

@237dmitry
Copy link

3

@vefatica
Copy link
Author

I want to change what ^[[0m means.

@237dmitry
Copy link

I want to change what ^[[0m means.

esc[0m resets previous combination of esc-sequences to default console colors (colors from console preferences). Then the prompt sets colors again and we do not notice the changes.

@vefatica
Copy link
Author

Are you saying I cannot change the defaults (ESC[0m) on the fly and temporarily?

@237dmitry
Copy link

You can but it is necessary to take into account the fact that esc[0m resets to default.

@vefatica
Copy link
Author

If I can't change what ESC[0m does then I guess I can't change the defaults.

In WindowsTerminal I can change the whole palette (OSC4, 10, 11, 12) and ESC[0m respects such a change. My conhost.exe (from Windows 10.0.19044.1415 (2009, 21H2)) does not accept those sequences. OpenConsole.exe (from WTPreview 1.12) does accept them. Do you know whether the conhost.exe from the latest insider build accepts them?

@237dmitry
Copy link

If I can't change what ESC[0m does then I guess I can't change the defaults.

Do not use esc[0m. Instead of it use current colors you set. For example:

prompt $e[30;47m$s$g$s
cls

for /l %i in (40,1,47) do @set /p="^[[37;%im test ^[[30;47m"<nul

^[[30;47m instead of ^[[0m

@LuanVSO
Copy link
Contributor

LuanVSO commented Dec 29, 2021

echo ^[]4;0;rgb:FD/F6/E3^G^[]4;7;rgb:93/A1/A1^G

@vefatica
Copy link
Author

Thanks, @LuanVSO. Yesterday I tried getting the OSC sequences to work, but I couldn't. I should have remembered (and didn't) that "chaining" them (as in echo ^[]4;0;rgb:FD/F6/E3;7;rgb:93/A1/A1^G) doesn't work in the general audience conhost.exe. They do work in WT's openconsole.exe. And the stock conhost.exe honors them when they're not chained.

I have rather long (chained) sequences for each of WT's eight themes. Today I'll work on "un-chaining" them so they will work in the stock console.

Can anyone comment on how the insider version of conhost behaves in this respect?

@zadjii-msft zadjii-msft added the Issue-Question For questions or discussion label Jan 3, 2022
@zadjii-msft
Copy link
Member

Alright so this question got a little off the rails.

Can anyone comment on how the insider version of conhost behaves in this respect?

It's likely that the fix to allow for chaining this specific sequence is in Terminal openconsole.exe's but not ones that ship with the OS quite yet. There's a whole pile of issues about this that are broadly tracked in #942. I bet that #7578 was the PR that first implemented this in 1.5, but I don't think that's in the OS quite yet. There's not a rigorous timeline by which bugfixes flow from the Terminal repo to the OS one.

#11126 also has some related discussion.

I think that should answer your question?

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Resolution-Answered Related to questions that have been answered labels Jan 3, 2022
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Jan 7, 2022
@ghost
Copy link

ghost commented Jan 7, 2022

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@microsoft microsoft locked and limited conversation to collaborators Jan 7, 2022
@DHowett DHowett converted this issue into discussion #12106 Jan 7, 2022
@ghost ghost removed the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Jan 7, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Issue-Question For questions or discussion Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

4 participants