Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo off & CLS
- ::: Windows 10 VT sequence 255 bit color tester
- rem /* Enable Virtual terminal sequences. Requires restart to take effect. Remove ::: below if required. */
- ::: reg add HKCU\Console /v VirtualTerminalLevel /t REG_DWORD /d 1
- rem /* Define VT Escape character */
- For /F %%a in ('Echo Prompt $E^|cmd ')Do set "\E=%%a"
- rem /* Assign initial values for color and display output */
- Set "FB=38" & Set "Color=R" & Set /A _48R=_48G=_48B=0,_38R=_38G=_38B=255,Increment=5
- rem /* Reduce if condition usage in Choice loop by use of Mode[] Array for modifying definitions */
- Set "Mode[A]=Set "Auto=0""
- Set "Mode[R]=Set "Color=R""
- Set "Mode[G]=Set "Color=G""
- Set "Mode[B]=Set "Color=B""
- Set "Mode[38]=ForeGround"
- Set "Mode[48]=BackGround"
- Set "Controls=%\E%[0m" & Set "QUIT="
- Setlocal EnableDelayedExpansion
- Set "Increments="
- For /L %%n in (1 1 9)Do ( Set "Mode[%%n]=Set "Increment=%%n"" & Set "Increments=!Increments!%%n" )
- rem /* Output macro to display formatted content with Updated values. Escaped for definition in Delayed Expansion environment. */
- Set "Output=For %%v in (^!FB^!)Do Echo/%\E%[?25l%\E%[1;1H^!Controls^![%\E%[31mR^!Controls^!] [%\E%[32mG^!Controls^!] [%\E%[34mB^!Controls^!] [M]ore [L]ess [S]witch FG/BG [E]xit%\E%[0m^!Quit^!%\E%[2;1H%\E%[48;2;^!_48R^!;^!_48G^!;^!_48B^!m%\E%[38;2;^!_38R^!;^!_38G^!;^!_38B^!m^!_%%vR^!%\E%[K%\E%[2;4H;^!_%%vG^!%\E%[K%\E%[2;8H;^!_%%vB^!%\E%[K%\E%[3;1H^!Controls^!%\E%[0mActive Color: ^!Color^!. Mode : ^!Mode[%%v]^! %\E%[4;1HIncrement [^!Increments^!]:^!Increment^!%\E%[0m"
- Set "DefaultKeys=LRMRBSLGMBSLGM" & Set "Auto=30"
- :loop
- For /F %%a in ('Set /A !random! %%14')Do Set "Default=!DefaultKeys:~%%a,1!"
- Set /A "MaxVal=255-Increment"
- rem /* Change Control color to black on black when Choice Auto mode selected; To indicate controls no longer Available */
- If "!Auto!" == "0" If not defined QUIT (Set "Controls=%\E%[7m%\E%[38;2;12;12;12m"& Set "QUIT=CTRL+C to Stop")
- %Output%
- For /F "Delims=" %%G in ('%__APPDIR__%Choice.exe /N /T !Auto! /C:RGBAMLSE!Increments! /D !Default!')Do (
- %!! Cursor Down; Exit =% If %%G==E ( <nul set /p "=%\E%[?25h%\E%B" & Goto :Eof )
- %= Switch between Forground / background color. =% If %%G==S ( If "!FB!" == "38" (Set "FB=48")Else (Set "FB=38") )
- %= Increase Active Color if Increment would not exceed 255 =% If %%G==M If !_%FB%%Color%! LEQ !MaxVal! (Set /A "_!FB!!Color!+=Increment")
- %= Decrease Active Color if Decrement would not go below 0 =% If %%G==L If !_%FB%%Color%! GEQ !Increment! (Set /A "_!FB!!Color!-=Increment")
- %= Use Mode[] Array to change value of the selected type. =% If not "!Mode[%%G]!"=="" (!Mode[%%G]!)
- )
- Goto :loop
Add Comment
Please, Sign In to add comment