Code: Alles auswählen
;fg = Vordergrundfarbe (-1 für Standardvordergrundfarbe)
;bg = Hintergrundfarbe (-1 für Standardhintergrundfarbe)
Procedure _ConsoleColor(fg,bg)
ostr.s=Chr(27)+"[0"
If fg<>-1
Select fg&%0111
Case %000 ;black / dark grey
ostr+";30"
Case %001 ;blue / light
ostr+";34"
Case %010 ;green / light
ostr+";32"
Case %011 ;cyan / light
ostr+";36"
Case %100 ;red / light
ostr+";31"
Case %101 ;magenta / light
ostr+";35"
Case %110 ;brown / yellow
ostr+";33"
Case %111 ;light grey / white
ostr+";37"
EndSelect
If (fg&%1000)
ostr+";1" ;make it bright
EndIf
EndIf
If bg<>-1
Select bg&%0111
Case %000 ;black / dark grey
ostr+";40"
Case %001 ;blue / light
ostr+";44"
Case %010 ;green / light
ostr+";42"
Case %011 ;cyan / light
ostr+";46"
Case %100 ;red / light
ostr+";41"
Case %101 ;magenta / light
ostr+";45"
Case %110 ;brown / yellow
ostr+";43"
Case %111 ;light grey / white
ostr+";47"
EndSelect
EndIf
ostr+"m"
Print(ostr)
EndProcedure
2. Hinweis: Helle Hintergrundfarben (8 ... 15) werden nicht unterstützt.
3. Hinweis: getestete Konsolen:
- Konsole 2.0
Linuxkonsole (Alt+Fx, openSuSE 11.0)
xterm
Gnome-Terminal
