8 "github.com/wsxiaoys/terminal/color"
11 /* holds our palette, or 16 ANSI colors (8 normal colors + bright complements)
12 and two foreground/background colors. colors are 3 byte arrays (RGB) */
13 type ktPalette struct {
43 /* the default "control" ANSI color set (boring) */
44 var ansiColors = ktPalette {
46 black : [3]byte {0,0,0},
47 bblack : [3]byte {128,128,128},
49 red : [3]byte {128,0,0},
50 bred : [3]byte {255,0,0},
52 green : [3]byte {0,128,0},
53 bgreen : [3]byte {0,255,0},
55 yellow : [3]byte {128,128,0},
56 byellow : [3]byte {255,255,0},
58 blue : [3]byte {0,0,128},
59 bblue : [3]byte {0,0,255},
61 purple : [3]byte {128,0,128},
62 bpurple : [3]byte {255,0,255},
64 cyan : [3]byte {0,128,128},
65 bcyan : [3]byte {0,255,255},
67 white : [3]byte {128,128,128},
68 bwhite : [3]byte {255,255,255},
71 bg : [3]byte {255,255,255},
74 /* parses a colorfile, returns palette struct. given a nil file pointer,
75 returns standard ANSI color set (our "control") */
76 func parseColors(colorfile *os.File) (pal ktPalette, err error) {
78 return ansiColors, nil
81 func ktInit(dirPrepend string, port int, colorfilePath string) error {
83 color.Print("@yparsing colorfile :: @{|}")
84 file, err := os.Open(colorfilePath)
86 color.Printf("@r[%s]@{|} - bad colorfile path\n", xM)
87 return fmt.Errorf("%s\n", "bad colorfile path")
90 pal, err := parseColors(file)
94 color.Printf("@r[%s]@{|} - malformed colorfile\n", xM)
95 return fmt.Errorf("%s\n", "malformed colorfile")
98 color.Printf("@g[%s]@{|}\n", checkM)
100 color.Printf("@ystarting httpd on port @b%d@{|} :: ", port)
107 err := ktInit("kolors", 999, "/home/kremlin/go/src/k_transpose/kremlin_colors");
109 /* make sure to close() anything you need to (you need to) */
110 resp, err := http.Get("http://kremlin.cc")