June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -0,0 +1,14 @@
|
|||
# Project : Terminal control/Coloured text
|
||||
# Date : 2018/04/19
|
||||
# Author : Gal Zsolt [~ CalmoSoft ~]
|
||||
# Email : <calmosoft@gmail.com>
|
||||
|
||||
load "consolecolors.ring"
|
||||
|
||||
forecolors = [CC_FG_BLACK,CC_FG_RED,CC_FG_GREEN,CC_FG_YELLOW,
|
||||
CC_FG_BLUE,CC_FG_MAGENTA,CC_FG_CYAN,CC_FG_GRAY,CC_BG_WHITE]
|
||||
|
||||
for n = 1 to len(forecolors)
|
||||
forecolor = forecolors[n]
|
||||
cc_print(forecolor | CC_BG_WHITE, "Rosetta Code" + nl)
|
||||
next
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
object ColouredText extends App {
|
||||
val ESC = "\u001B"
|
||||
val (normal, bold, blink, black, white) =
|
||||
(ESC + "[0", ESC + "[1"
|
||||
, ESC + "[5" // not working on my machine
|
||||
, ESC + "[0;40m" // black background
|
||||
, ESC + "[0;37m" // normal white foreground
|
||||
)
|
||||
|
||||
print(s"${ESC}c") // clear terminal first
|
||||
print(black) // set background color to black
|
||||
def foreColors = Map(
|
||||
";31m" -> "red",
|
||||
";32m" -> "green",
|
||||
";33m" -> "yellow",
|
||||
";34m" -> "blue",
|
||||
";35m" -> "magenta",
|
||||
";36m" -> "cyan",
|
||||
";37m" -> "white")
|
||||
|
||||
Seq(normal, bold, blink).flatMap(attr => foreColors.map(color => (attr, color)))
|
||||
.foreach { case (attr, (seq, text)) => println(s"$attr${seq}${text}") }
|
||||
println(white) // set foreground color to normal white
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue