Advertisement
IcarusLives

Rainbow Text function

Feb 18th, 2017
1,301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.22 KB | None | 0 0
  1. :: ---------------------------------------------------------------------------------------------------------------------------
  2. :: Displays rainbow text up to 45 chars
  3. ::
  4. :: call :init_rainbow
  5. :: call :rainbow_text "TEXT
  6. ::
  7. :: ---------------------------------------------------------------------------------------------------------------------------
  8. :rainbow_text
  9.     set "str=x%~1" & <nul set /p ".=["
  10.     for %%a in (%rainbow_text%) do (
  11.         set /a "i+=1"
  12.         call set "ex_str=%%str:~!i!,1%%"
  13.        
  14.        
  15.         if "!ex_str!" equ "" ( <nul set /p ".=]" & echo. & goto :eof )
  16.         if "!ex_str!" equ " " (
  17.             <nul set /p ".=] ["
  18.         ) else (
  19.             (> colorPrint.txt (echo [!ex_str!]\..\') && findstr /a:0%%a /f:colorPrint.txt ".")
  20.         )
  21.     )
  22.  
  23. :init_rainbow
  24.     set "rainbow_text=4 C 6 E 2 A 1 9 3 B 5 D F 7 8 0 4 C 6 E 2 A 1 9 3 B 5 D F 7 8 0 4 C 6 E 2 A 1 9 3 B 5 D F 7 8 0"
  25.     for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E & echo on & for %%b in (1) do rem"') do set "DEL=%%a"
  26.     <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%" > "'"
  27. goto :eof
  28. :: ---------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement