I want to change the final result of Powershell on VSCode to another color, I've tried to use terminal.foreground
but it change the URL too (I just want the result "I love pizza" to lime green. Thank you guys so much
Asked
Active
Viewed 376 times
0

Vitalizzare
- 4,496
- 7
- 13
- 32

Chester Nguyen
- 1
- 2
-
I don't see any url on your image. But maybe you should change back foreground after displaying `I love pizza` – furas Jun 04 '22 at 17:02
-
what ` do you mean `"terminal.foreground"`? Is this some code in Python or settings in VSCode? Some terminals can use special codes in `print()` to change color for selected part of text - and there are even modules for this - i.e `bless`, `rich` – furas Jun 04 '22 at 17:04
-
Let me know if that duplicate target doesn't answer your question @ChesterNguyen – Christian Dean Jun 04 '22 at 17:11
1 Answers
2
What you are looking for are called "ANSI Color Codes". They can be a bit hard to wrap your head around, but essentially you print a series of characters that change the style of output text, or reset the style.
A better approach for you would be to use a module that abstracts ANSI Color Codes into a more user-friendly API to style your text. Check out colorama and rich.

danielhoherd
- 481
- 2
- 5