0

Trying to set the background for line 1 to white and line 2 to black. ASN1 Esc codes seems it would be the fastest way to get it. However it only changed the background at specified text not entire line.

Example of what I'm hoping for:

@echo off
echo <Esc>[107m This Entire line has a white background
echo <Esc>[40m This Entire Line has a black background
pause

what I am getting: Output

Compo
  • 36,585
  • 5
  • 27
  • 39
  • 1
    The color isn't applied by magic for the complete line, you need to force to print to the end of line by using spaces of better `[K` – jeb Dec 16 '19 at 15:49

1 Answers1

0

Jebs Comment is spot on.

Set the line position, invert the line, 'K' clear the line & then Position your text to save all that nasty spaces busines.

ECHO <ESC>[1;1H<ESC>[07m<ESC>[K<ESC>[1;55H Hello world
T3RR0R
  • 2,747
  • 3
  • 10
  • 25
  • Thank you both for the answer and examples. Works wonders, still diving into ASN1 appreciate the boost! – Andrew Henry Dec 16 '19 at 16:19
  • It's quite useful, definitely an upgrade for Batch on the visual level. This is a basic example of an Ansi Animation if your interested - https://pastebin.com/N8wQADXG – T3RR0R Dec 16 '19 at 17:10
  • See also https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences For extra tips on Stringing multiple ANSI codes together – T3RR0R Dec 16 '19 at 17:29