T3RRYT3RR0R

Batch Color Checker 255 bit

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