mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Fix terminal coloring for FreeBSD
This commit is contained in:
parent
977f7a9dcc
commit
c0695c34a9
@ -76,9 +76,14 @@ for (ver,key1,key2,subdir) in MAXVERSIONINFO:
|
|||||||
WARNINGS=[]
|
WARNINGS=[]
|
||||||
THREADS={}
|
THREADS={}
|
||||||
HAVE_COLORS=False
|
HAVE_COLORS=False
|
||||||
|
SETF=""
|
||||||
try:
|
try:
|
||||||
import curses
|
import curses
|
||||||
curses.setupterm()
|
curses.setupterm()
|
||||||
|
SETF=curses.tigetstr("setf")
|
||||||
|
if (SETF == None):
|
||||||
|
SETF=curses.tigetstr("setaf")
|
||||||
|
assert SETF != None
|
||||||
HAVE_COLORS=sys.stdout.isatty()
|
HAVE_COLORS=sys.stdout.isatty()
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
@ -86,17 +91,17 @@ def GetColor(color = None):
|
|||||||
if not HAVE_COLORS: return ""
|
if not HAVE_COLORS: return ""
|
||||||
if color != None: color = color.lower()
|
if color != None: color = color.lower()
|
||||||
if (color == "blue"):
|
if (color == "blue"):
|
||||||
return curses.tparm(curses.tigetstr("setf"), 1)
|
return curses.tparm(SETF, 1)
|
||||||
elif (color == "green"):
|
elif (color == "green"):
|
||||||
return curses.tparm(curses.tigetstr("setf"), 2)
|
return curses.tparm(SETF, 2)
|
||||||
elif (color == "cyan"):
|
elif (color == "cyan"):
|
||||||
return curses.tparm(curses.tigetstr("setf"), 3)
|
return curses.tparm(SETF, 3)
|
||||||
elif (color == "red"):
|
elif (color == "red"):
|
||||||
return curses.tparm(curses.tigetstr("setf"), 4)
|
return curses.tparm(SETF, 4)
|
||||||
elif (color == "magenta"):
|
elif (color == "magenta"):
|
||||||
return curses.tparm(curses.tigetstr("setf"), 5)
|
return curses.tparm(SETF, 5)
|
||||||
elif (color == "yellow"):
|
elif (color == "yellow"):
|
||||||
return curses.tparm(curses.tigetstr("setf"), 6)
|
return curses.tparm(SETF, 6)
|
||||||
else:
|
else:
|
||||||
return curses.tparm(curses.tigetstr("sgr0"))
|
return curses.tparm(curses.tigetstr("sgr0"))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user