T3RRYT3RR0R

ANSI colors

Dec 15th, 2019
1,009
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.56 KB | None | 0 0
  1. @Echo off & Goto :Main
  2. REM For windows 10, there's a much simpler option for color handling when displaying text with a variety of colors on the same screen.
  3.  
  4.     ECHO  black background red text
  5.     ECHO  black background green text
  6.     ECHO  black background yellow text
  7.     ECHO  black background dark blue text
  8.     ECHO  black background purple text
  9.     ECHO  black background light blue text
  10.     ECHO  black background white text
  11.     ECHO  black background grey text
  12.  
  13.     ECHO  invert background and text color (requires [0m to revert to non inverted colors)
  14.     ECHO  underline text (requires  to disable underlining)
  15.     ECHO  lighten the text color (requires  to revert to normal color intensity)
  16.  
  17. REM Other Ansi options include Cursor positioning to change what line and column text is echoed at
  18.  
  19.     ECHO  (ine;ColumnH)
  20.  
  21. REM and clear all text from line / column position (for that line only)
  22.  
  23.     ECHO   (Text can be printed on this line, starting at the coordinates specified)
  24.  
  25. REM Color options can be combined, and changed at any point on a line, multiple times:
  26.  
  27.     ECHO  (will invert to yellow background with black text)
  28. REM    (until  is used to reset to default)
  29.     ECHO  (will invert to light yellow background with black text)
  30. REM    (until  is used to reset to default)
  31.  
  32.     ECHO ROYGBIV
  33.  
  34. REM red R dark yellow O light yellow Y green G lightblue B light purple I dark purple V
  35.  
  36. REM Colors will persist until you use another ansi color code to change color or restore default.
  37. REM Using CMD's Color XX will cause text / background to display as they normally would with the color / Background color selected
  38. REM until another Ansi Color Code is used.
  39.  
  40. REM Adoption of the Ansi color system in windows 10 opens up some interesting possibilites for ansi Art and animation (particularly
  41. REM with the cursor positioning allowing more refined control over what text gets displayed where, without affecting other lines).
  42.  
  43. *** Example of using codes within Variables***
  44. :main
  45.  
  46. Set "Red="
  47. Set "Pink="
  48. Set "Green="
  49. Set "Light_Green="
  50. Set "Yellow="
  51. Set "Light_Yellow="
  52. Set "Blue="
  53. Set "Light_Blue="
  54. Set "Purple="
  55. Set "Magenta="
  56. Set "Cyan="
  57. Set "White="
  58. Set "Grey="
  59.  
  60.  
  61. Echo(%blue%This is a Blue example, %Pink%Now Pink. %Green%Here's some Green.
  62. Pause
Advertisement
Add Comment
Please, Sign In to add comment