1# -*- tcl -*-
2# (C) 2008 Andreas Kupries <andreas_kupries@users.sourceforge.net>
3##
4# ###
5
6namespace eval ::sak::color {}
7
8# ###
9
10if {$::tcl_platform(platform) == "windows"} {
11    # No ansi colorization on windows
12    namespace eval ::sak::color {
13	variable n
14	foreach n {cya yel whi mag red rst} {
15	    proc $n {} {return ""}
16	    namespace export $n
17
18	    proc =$n {s} {return $s}
19	    namespace export =$n
20	}
21	unset n
22    }
23} else {
24    getpackage term::ansi::code::attr term/ansi/code/attr.tcl
25    getpackage term::ansi::code::ctrl term/ansi/code/ctrl.tcl
26
27    ::term::ansi::code::ctrl::import ::sak::color sda_bg* sda_reset
28
29    namespace eval ::sak::color {
30	variable s
31	variable n
32	foreach {s n} {
33	    sda_bgcyan    cya
34	    sda_bgyellow  yel
35	    sda_bgwhite   whi
36	    sda_bgmagenta mag
37	    sda_bgred     red
38	    sda_reset     rst
39	} {
40	    rename $s $n
41	    namespace export $n
42
43	    proc =$n {s} "return \[$n\]\$s\[rst\]"
44	    namespace export =$n
45	}
46	unset s n
47    }
48}
49
50##
51# ###
52
53package provide sak::color 1.0
54