banner.txt ansi color code not working in Windows 10 console
See original GitHub issueHello. banner.txt ansi colors doesn’t work in Windows 10 console. Example:
banner.txt
${AnsiColor.RED}HELLO
The “HELLO” word should be red colored, but it doesn’t in both cmd console and powershell console. But Window10 still supports ansi colors:
https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85).aspx
To test it I wrote a simple .bat file able to show colors in a standard cmd console:
test.bat
@echo <ESC>[31mHELLO<ESC>[0m
Where <ESC> is the escape character (alt+027). This .bat shows the “HELLO” word red colored.
I tried to use the same escape sequence in banner.txt but it doesn’t work too. It displays a broken character followed by [31m
Perhaps Spring Boot ansi constants are incorrect for a Window 10 environment?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Use ANSI colors in the terminal - Windows CMD - SS64.com
Specify the color codes in a batch file by ECHOing the foreground and/or background color codes (from the following table) followed by the...
Read more >Text art/Banner Not Appearing In cmd Prompt (Unicode/ASCII)
I figured it out. You need to enable "Use Legacy Console". Once you do that and restart the console the FreeMono font is...
Read more >Support for colors in console output : IDEA-69880 - YouTrack
My ANSI color codes in my LogBack configuration do work in Eclipse console, but not in IDEA. :-( This happens even having installed...
Read more >Spring Boot - Enabling Color Coded Output - LogicBig
Spring boot can display ANSI color coded output if the target terminal supports it. We need to set spring.output.ansi.enabled property.
Read more >Spring Boot Banner - Complete Guide | SpringHow
To mark a text with yellow, wrap the content between ${AnsiColor.YELLOW} and ${AnsiColor.DEFAULT} . For background and text styles, the concept is the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Windows 10 turns the Virtual Terminal Support OFF by default. You have three options: 1.In registry key [HKEY_CURRENT_USER\Console], create or set the VirtualTerminalLevel DWORD value to 1 2.Call to the SetConsoleMode() Windows API inside your program 3.Pipe output from external programs to Out-Host, like java -jar xxx.jar | Out-Host
https://stackoverflow.com/a/51681675/9480909
I did a small research: it looks like pure java is not able to output ansi color the way a Windows console want them. I’ve found this project:
https://github.com/fusesource/jansi
Which expose two functions to enable/disable colored ansi output even on Windows. By using the library I was able to see colored output in a dos console:
Anyway I was not able to see spring boot colored banner even with Jansi:
To summarize:
Thanks to everyone!