CSE321Week9 - The ^[ Symbol The ^[ symbol corresponds to...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 321 Panya Chanawangsa pc57@buffalo.edu
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Today’s Agenda • Changing text and terminal colors
Background image of page 2
Changing text and terminal colors source : http://ascii-table.com/ansi-escape-sequences.php Color chart
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Text Attributes
Background image of page 4
Changing Terminal Attributes • To change the terminal attributes in a Linux shell: > echo “^[[ attribute ; text_color ; background_color m” # Underscore the text, use magenta for text, and # black as the background color > echo “^[[4;35;40m” # Resets the terminal back to the default attributes. > echo “^[[0;37;40m”
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The ^[ Symbol The ^[ symbol corresponds to the ESC character. To type that character in a Linux shell: Press ctrl + v and then ESC Its Ascii value is 27. In C To change the attributes of the terminal in a XINU program, you can do the following: fprintf(stdout, "%c[4;35;40m", 27); where 27 is the Ascii value of ESC sprintf Or you can use sprintf to do the job: char color_code[13]; sprintf(color_code, "%c[%d;%d;%dm", 27, attribute, text_color, background_color); printf("%s", color_code);...
View Full Document

Page1 / 9

CSE321Week9 - The ^[ Symbol The ^[ symbol corresponds to...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online