RGB colors using VT100 - Win 10 only

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
IcarusLives
Posts: 175
Joined: 17 Jan 2016 23:55

RGB colors using VT100 - Win 10 only

#1 Post by IcarusLives » 25 Aug 2017 15:08

Hello all ^-^

Still playing with VT100 because honestly it's extremely fun.

Image

After doing some research I found you could use RGB colors as well!

All of the magic happens with this line

Code: Select all

<nul set /p "=ESC[38;2;R;G;Bm TEXT" ESC[0m


Still researching to see if it will do HSL. That would be very cool!

Anyway, I hope you all enjoy!

Code: Select all

@echo off & setlocal enableDelayedExpansion & mode 80,15

for /F %%a in ('echo prompt $E^| cmd') do set "ESC=%%a"

set "s=/\\/\\/\\/\\/\\/\\/\\"

for /l %%a in (0,1,10) do ( for /l %%c in (0,1,77) do (

      set /a "r=255 - (%%c * 255 / 76)", "g=(%%c * 510 / 76)", "b=(%%c * 255 / 76)"
      if !g! gtr 255 set /a "g=510 - g"
      
      <nul set /p "=%ESC%[38;2;!r!;!g!;!b!m!s:~0,1!"%ESC%[0m
      set "s=!s:~1!!s:~3,1!"
   )
   echo.
)

pause & exit

dbenham
Expert
Posts: 2461
Joined: 12 Feb 2011 21:02
Location: United States (east coast)

Re: RGB colors using VT100 - Win 10 only

#2 Post by dbenham » 25 Aug 2017 15:36

I also did some research into version 10 VT100 sequences.

But I was not aware of the RGB capabilities :!:
Very cool 8)


Dave Benham

Post Reply