Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Console and color

From: oliva:david:seznam:cz at: 13-Aug-2002 15:07

Hello Philippe, Monday, August 12, 2002, 11:06:37 PM, you wrote: PO> Is it possible to print in different colors on the console's line ? If yes, PO> how to ? Has Someone already wrote a code for that ? PO> PHilippe In windows no.... in Unix with ANSI terminal yes... just use ANSI escape sequences.... look at this script I'm now working on: http://oldes.multimedia.cz/r-sys/ansi2.r here you can see how escape sequences for colors looks like: ;foregrounds | ["30m" | "1;30m"] (ChTs/f 0.0.0) | "31m" (ChTs/f 132.0.0) | "1;31m" (ChTs/f 172.0.0) | "32m" (ChTs/f 0.130.0) | "1;32m" (ChTs/f 0.170.0) | "33m" (ChTs/f 132.130.0) | "1;33m" (ChTs/f 172.170.0) | "34m" (ChTs/f 0.0.132) | "1;34m" (ChTs/f 0.0.172) | "35m" (ChTs/f 132.0.132) | "1;35m" (ChTs/f 172.0.172) | "36m" (ChTs/f 0.130.132) | "1;36m" (ChTs/f 0.170.172) | "37m" (ChTs/f 235.235.235) | "1;37" (ChTs/f 255.255.255) ;backgrounds | ["40m" | "1;40m"] (ChTs/b 0.0.0) | "41m" (ChTs/b 132.0.0) | "1;41m" (ChTs/b 172.0.0) | "42m" (ChTs/b 0.130.0) | "1;42m" (ChTs/b 0.170.0) | "43m" (ChTs/b 132.130.0) | "1;43m" (ChTs/b 172.170.0) | "44m" (ChTs/b 0.0.132) | "1;44m" (ChTs/b 0.0.172) | "45m" (ChTs/b 132.0.132) | "1;45m" (ChTs/b 172.0.172) | "46m" (ChTs/b 0.130.132) | "1;46m" (ChTs/b 0.170.172) | "47m" (ChTs/b 235.235.235) | "1;47m" (ChTs/b 255.255.255) so when you do: print "^[[41msome text" background will be set to dark red color until you type: print "^[[0m" == reset to default but this works only in ANSI terminals