Change text color in Windows PowerShell #7083

Closed
opened 2026-01-31 00:54:30 +00:00 by claunia · 7 comments
Owner

Originally created by @avdain on GitHub (Mar 22, 2020).

Environment

Windows build number: 10.0.18363.0
Windows Terminal version: 0.10.781.0

Any other software?

Steps to reproduce

  • First, start the Windows PowerShell command prompt
  • Now run the CMD command, which starts a new command prompt
  • After the command prompt starts, type and then run the ("color a") command
  • You must now start Windows PowerShell by typing this command ("powershell.exe")

Expected behavior

Windows PowerShell should return to its default text color.

Actual behavior

The text color of Windows PowerShell has been changed

Anmerkung 2020-03-22 065013

Originally created by @avdain on GitHub (Mar 22, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18363.0 Windows Terminal version: 0.10.781.0 Any other software? ``` # Steps to reproduce - First, start the Windows PowerShell command prompt - Now run the CMD command, which starts a new command prompt - After the command prompt starts, type and then run the ("color a") command - You must now start Windows PowerShell by typing this command ("powershell.exe") <!-- A description of how to trigger this bug. --> # Expected behavior **Windows PowerShell should return to its default text color.** <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior <!-- What's actually happening? --> **The text color of Windows PowerShell has been changed** ![Anmerkung 2020-03-22 065013](https://user-images.githubusercontent.com/47790579/77243457-72d11800-6c0a-11ea-851d-da78177aeb4a.png)
claunia added the Resolution-By-DesignNeeds-Tag-Fix labels 2026-01-31 00:54:31 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 22, 2020):

This is how the Color tool is supposed to work.

@DHowett-MSFT commented on GitHub (Mar 22, 2020): This is how the Color tool is supposed to work.
Author
Owner

@avdain commented on GitHub (Mar 22, 2020):

This should not happen. Windows PowerShell should return to its default text color.

@avdain commented on GitHub (Mar 22, 2020): This should not happen. Windows PowerShell should return to its default text color.
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 22, 2020):

Every console application accepts a change in color! That’s one of the coolest things about console applications. Powershell doesn’t reset the color, so you can make it appear in whatever color you want.

This is because a terminal has an “active” color, and that active color is used to write all new text. CMD’s color command changes the active color. Powershell respects the active color because that is what a well behaved application does 😄

@DHowett-MSFT commented on GitHub (Mar 22, 2020): _Every_ console application accepts a change in color! That’s one of the coolest things about console applications. Powershell doesn’t reset the color, so you can make it appear in whatever color you want. This is because a terminal has an “active” color, and that active color is used to write all new text. CMD’s `color` command changes the active color. Powershell respects the active color because that is what a well behaved application does 😄
Author
Owner

@avdain commented on GitHub (Mar 23, 2020):

I am very happy that you continue to write with me. 😄
But there is still a small error that I want to explain. Windows PowerShell has a green text color at the end but not anymore when a Windows terminal user starts to execute a function in Windows PowerShell that does not exist.

  • Thanks for the answer! 👍😄

Anmerkung 2020-03-23 091120

@avdain commented on GitHub (Mar 23, 2020): I am very happy that you continue to write with me. 😄 But there is still a small error that I want to explain. **Windows PowerShell has a green text color at the end but not anymore when a Windows terminal user starts to execute a function in Windows PowerShell that does not exist**. - Thanks for the answer! 👍😄 ![Anmerkung 2020-03-23 091120](https://user-images.githubusercontent.com/47790579/77295463-52768b80-6ce6-11ea-99fa-1a65fe594f07.png)
Author
Owner

@DHowett-MSFT commented on GitHub (Mar 23, 2020):

I'm happy to help!

Here's what's happening.

  1. color a sets the "active" color to a
  2. cmd exits
  3. powershell starts printing text in "active" color a
  4. powershell wants to print an error message
  5. powershell sets the color to 8 (bright red)
  6. powershell prints the error message in 8
  7. powershell doesn't know what the old color used to be (a), so it uses its hardcoded default 7 (plain white)

Unfortunately, Terminal doesn't know what powershell is doing: it only sees text and color commands. It is powershell's job to make sure the colors remain correct. 😄

@DHowett-MSFT commented on GitHub (Mar 23, 2020): I'm happy to help! Here's what's happening. 1. `color a` sets the "active" color to `a` 2. cmd exits 3. powershell starts printing text in "active" color `a` 4. powershell wants to print an error message 5. powershell sets the color to `8` (bright red) 6. powershell prints the error message in `8` 7. powershell _doesn't know_ what the old color used to be (`a`), so it uses its hardcoded default `7` (plain white) Unfortunately, Terminal doesn't know what powershell is doing: it only sees text and color commands. It is powershell's job to make sure the colors remain correct. :smile:
Author
Owner

@avdain commented on GitHub (Mar 23, 2020):

Unfortunately, Terminal doesn't know what powershell is doing: it only sees text and color commands. It is powershell's job to make sure the colors remain correct. 😄

PowerShell did not reset the text colors correctly.
When a Windows terminal user starts typing this text [a] in PowerShell, the square brackets turn green

  • Thanks for the answer! 😄
@avdain commented on GitHub (Mar 23, 2020): > Unfortunately, Terminal doesn't know what powershell is doing: it only sees text and color commands. It is powershell's job to make sure the colors remain correct. 😄 PowerShell did not reset the text colors correctly. When a Windows terminal user starts typing this text `[a]` in PowerShell, the square brackets turn green - **Thanks for the answer! 😄**
Author
Owner

@DHowett-MSFT commented on GitHub (May 5, 2020):

This is, as described above, completely on purpose. This is by design.

@DHowett-MSFT commented on GitHub (May 5, 2020): This is, as described above, completely on purpose. This is by design.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7083