shades.go

 1package markdown
 2
 3var headingShades = []func(a ...interface{}) string{
 4	GreenBold,
 5	GreenBold,
 6	HiGreen,
 7	Green,
 8}
 9
10// Return the color function corresponding to the level.
11// Beware, level start counting from 1.
12func headingShade(level int) func(a ...interface{}) string {
13	if level < 1 {
14		level = 1
15	}
16	if level > len(headingShades) {
17		level = len(headingShades)
18	}
19	return headingShades[level-1]
20}
21
22var quoteShades = []func(a ...interface{}) string{
23	GreenBold,
24	GreenBold,
25	HiGreen,
26	Green,
27}
28
29// Return the color function corresponding to the level.
30func quoteShade(level int) func(a ...interface{}) string {
31	if level < 1 {
32		level = 1
33	}
34	if level > len(quoteShades) {
35		level = len(quoteShades)
36	}
37	return quoteShades[level-1]
38}