require stack.fs

\ escape sequences
: esc		( -- )	27 emit ;
: c-normal	( -- )	esc ." [0m" ;
: c-bold	( -- )	esc ." [1m" ;
: c-black	( -- )	esc ." [;30m" ;
: c-red 	( -- )	esc ." [;31m" ;
: c-green	( -- )	esc ." [;32m" ;
: c-yellow	( -- )	esc ." [;33m" ;
: c-blue	( -- )	esc ." [;34m" ;
: c-purple	( -- )	esc ." [;35m" ;
: c-cyan	( -- )	esc ." [;36m" ;
: c-white	( -- )	esc ." [;37m" ;
: c-gray	( -- )	esc ." [;38m" ;

: c-success	( -- )	c-green		;
: c-warning	( -- )	c-yellow	;
: c-error		( -- )	c-red		;
: c-info		( -- )	c-cyan		;

\ executes xt-cs, prints the string and executes xt-cr
: coltype ( xt-cs c-addr u xt-cr -- )
	>r rot ex type r> ex ;

\ prints a colored status message
: msg ( c-addr u c-addr u xt -- )
	." [" execute type c-normal ." ] " type ;

(
' c-bold s" message" ' c-normal coltype
' c-bold ' c-red 2 bat s" message" ' c-normal coltype
)
