Text Files - Coloured Characters
Moderator: DosItHelp
Text Files - Coloured Characters
In the good old days of DOS , a text file contained individual characters preceded by a color code byte (background color and text/character color) for EACH character. Has that ability been lost? Is there a feature in DOS or some software that can still do that coloring? If so , how do you display the character-colored file in Windows (like my XP)?
Re: Text Files - Coloured Characters
You could use vt100 codes which are virtual terminal sequences:
https://docs.microsoft.com/en-us/window ... -sequences
Example:
viewtopic.php?f=3&t=8044
You might also want to read the folowing:
viewtopic.php?f=3&t=9144
penpen
https://docs.microsoft.com/en-us/window ... -sequences
Example:
viewtopic.php?f=3&t=8044
You might also want to read the folowing:
viewtopic.php?f=3&t=9144
penpen
-
- Posts: 175
- Joined: 17 Jan 2016 23:55
Re: Text Files - Coloured Characters
I very much appreciate you using MY code as an example! How exciting
OP,
Here are some examples of coloring with VT100. Mind you, this is a WIN10 feature.
The method below is using string substitution. You will notice VT100 colors very quickly.
Code: Select all
@echo off & setlocal enableDelayedExpansion
rem DEFINE ESC
for /f %%a in ('echo prompt $E^| cmd') do set "esc=%%a"
set "background=%esc%[48;5;cm"
set "textColor=%esc%[38;5;cm"
set "RGB=%esc%[38;2;r;g;bm"
set "resetAttribute=%esc%[0m"
echo %background:c=9%Hello World%resetAttribute%
echo %textColor:c=10%Hello World%resetAttribute%
echo %RGB:r;g;b=190;80;170%Hello World%resetAttribute%
pause>nul
Re: Text Files - Coloured Characters
Hi > IcarusLives
* Thank you for your quick reply * I created a batch file with your code * It ran in XP but I only got the result > see attached image *
* It seems like nobody has written a text editor that will do this ancient form of text * It must have been possible back in the days . . . * Possibly ASCII art can do it but I just wanted to edit and display simple text * I downloaded > Personal Editor - pe32.zip < from > http://www.pe32.com/index.html < but that didn't do it either unless I don't know how to use that program well enough yet *
* Your batch programs seems to want to operate properly but it doesn't do the "sets" correctly *
* Thank you for your help *
POSAM
[img]file:E:\Colors.gif[/img]
* Thank you for your quick reply * I created a batch file with your code * It ran in XP but I only got the result > see attached image *
* It seems like nobody has written a text editor that will do this ancient form of text * It must have been possible back in the days . . . * Possibly ASCII art can do it but I just wanted to edit and display simple text * I downloaded > Personal Editor - pe32.zip < from > http://www.pe32.com/index.html < but that didn't do it either unless I don't know how to use that program well enough yet *
* Your batch programs seems to want to operate properly but it doesn't do the "sets" correctly *
* Thank you for your help *
POSAM
[img]file:E:\Colors.gif[/img]
Re: Text Files - Coloured Characters
* I do appreciate your efforts to get me going on editing and displaying colored text the old fashioned DOS text way * Obviously , this capability has been lost to the history books * So , having spent many hours finding and downloading ASCII text editors and even using your batch solution , nothing seems to work * And , so , I will now move on to something much more productive in my life * Thanks again *
* BTW - it would be nice if one could attach a file , like an image file or text file * This website seems to be limited to URL protocols and not everyone has a website for you to access files *
POSAM
* BTW - it would be nice if one could attach a file , like an image file or text file * This website seems to be limited to URL protocols and not everyone has a website for you to access files *
POSAM
Re: Text Files - Coloured Characters
As long as you still stick with XP you're out of luck. ANSI escape sequences are supported on Windows 10 version 10.0.10586 onwards.
If you don't want to use 3rd party tools on older Windows versions then check out FINDSTR /A workarounds like these
viewtopic.php?p=41155#p41155
viewtopic.php?p=22243#p22243
Steffen
If you don't want to use 3rd party tools on older Windows versions then check out FINDSTR /A workarounds like these
viewtopic.php?p=41155#p41155
viewtopic.php?p=22243#p22243
Steffen
-
- Posts: 128
- Joined: 23 May 2016 15:39
- Location: Spain
Re: Text Files - Coloured Characters
or you may try ansicon