|
@@ -234,7 +234,6 @@ func MakeColorsRender(brackets string, text_color string, colors map[string]stri
|
|
|
words := find_words(text)
|
|
|
var option bool = true
|
|
|
var color_word bool = false
|
|
|
- var tpos int = 0
|
|
|
var result string
|
|
|
var last_color string
|
|
|
var word_color string
|
|
@@ -242,7 +241,7 @@ func MakeColorsRender(brackets string, text_color string, colors map[string]stri
|
|
|
word_pair := words[words_id]
|
|
|
normal := colors["ALL"]
|
|
|
|
|
|
- for _, c := range text {
|
|
|
+ for tpos, c := range text {
|
|
|
if option {
|
|
|
if c == '[' || c == ']' {
|
|
|
if last_color != brackets {
|
|
@@ -279,7 +278,7 @@ func MakeColorsRender(brackets string, text_color string, colors map[string]stri
|
|
|
// look for COLOR word
|
|
|
if tpos >= word_pair[1] {
|
|
|
words_id++
|
|
|
- if words_id > len(words) {
|
|
|
+ if words_id >= len(words) {
|
|
|
word_pair = []int{999, 999}
|
|
|
} else {
|
|
|
word_pair = words[words_id]
|
|
@@ -289,7 +288,8 @@ func MakeColorsRender(brackets string, text_color string, colors map[string]stri
|
|
|
if word_pair[0] == tpos {
|
|
|
// start of word
|
|
|
possible := text[word_pair[0]:word_pair[1]]
|
|
|
- color_code, has := colors[possible]
|
|
|
+ color_code, has := colors[strings.ToUpper(possible)]
|
|
|
+ // log.Printf("Match %s / found %s %#v\n", possible, color_code, has)
|
|
|
if has {
|
|
|
word_color = color_code
|
|
|
} else {
|
|
@@ -310,6 +310,13 @@ func MakeColorsRender(brackets string, text_color string, colors map[string]stri
|
|
|
return renderF
|
|
|
}
|
|
|
|
|
|
+var DeckColors []string
|
|
|
+
|
|
|
+func init() {
|
|
|
+ DeckColors = []string{
|
|
|
+ "All", "Brown", "Green", "Red", "Blue", "Cyan", "Magenta", "White"}
|
|
|
+}
|
|
|
+
|
|
|
func DeckColorMenu() door.Menu {
|
|
|
m := door.Menu{Panel: door.Panel{Width: 31,
|
|
|
X: 5,
|
|
@@ -318,18 +325,34 @@ func DeckColorMenu() door.Menu {
|
|
|
Title: "[ Deck Menu ]",
|
|
|
TitleColor: door.ColorText("BRI CYAN ON BLUE"),
|
|
|
BorderColor: door.ColorText("CYAN ON BLUE")}}
|
|
|
- m.SelectedR = door.MakeMenuRender(door.ColorText("BOLD CYAN"),
|
|
|
+
|
|
|
+ unselectMap := map[string]string{"BLUE": door.ColorText("BRI BLUE ON BLUE"),
|
|
|
+ "BROWN": door.ColorText("BROWN ON BLUE"),
|
|
|
+ "RED": door.ColorText("BRI RED ON BLUE"),
|
|
|
+ "CYAN": door.ColorText("CYAN ON BLUE"),
|
|
|
+ "GREEN": door.ColorText("BRI GREEN ON BLUE"),
|
|
|
+ "MAGENTA": door.ColorText("BRI MAGENTA ON BLUE"),
|
|
|
+ "WHITE": door.ColorText("BRI WHITE ON BLUE"),
|
|
|
+ "ALL": door.ColorText("WHITE ON BLUE")}
|
|
|
+ selectMap := map[string]string{"BLUE": door.ColorText("BRI BLUE ON BLACK"),
|
|
|
+ "BROWN": door.ColorText("BROWN ON BLACK"),
|
|
|
+ "RED": door.ColorText("BRI RED ON BLACK"),
|
|
|
+ "CYAN": door.ColorText("CYAN ON BLACK"),
|
|
|
+ "GREEN": door.ColorText("BRI GREEN ON BLACK"),
|
|
|
+ "MAGENTA": door.ColorText("BRI MAGENTA ON BLACK"),
|
|
|
+ "WHITE": door.ColorText("BRI WHITE ON BLACK"),
|
|
|
+ "ALL": door.ColorText("WHITE ON BLACK")}
|
|
|
+
|
|
|
+ m.SelectedR = MakeColorsRender(door.ColorText("BOLD CYAN"),
|
|
|
door.ColorText("BOLD BLUE"),
|
|
|
- door.ColorText("BOLD CYAN"),
|
|
|
- door.ColorText("BOLD BLUE"))
|
|
|
- m.UnselectedR = door.MakeMenuRender(door.ColorText("BOLD YEL ON BLUE"),
|
|
|
+ selectMap)
|
|
|
+ m.UnselectedR = MakeColorsRender(door.ColorText("BOLD YEL ON BLUE"),
|
|
|
door.ColorText("BOLD WHI ON BLUE"),
|
|
|
- door.ColorText("BOLD YEL ON BLUE"),
|
|
|
- door.ColorText("BOLD CYAN ON BLUE"))
|
|
|
+ unselectMap)
|
|
|
|
|
|
- m.AddSelection("D", "Deck Colors")
|
|
|
- m.AddSelection("V", "View Settings")
|
|
|
- m.AddSelection("Q", "Quit")
|
|
|
+ for _, color := range DeckColors {
|
|
|
+ m.AddSelection(color[:1], color)
|
|
|
+ }
|
|
|
return m
|
|
|
}
|
|
|
|
|
@@ -386,6 +409,10 @@ func Configure(d *door.Door, db *DBData) {
|
|
|
switch option {
|
|
|
case 'D':
|
|
|
// Deck color
|
|
|
+ colormenu := DeckColorMenu()
|
|
|
+ d.Write(door.Clrscr)
|
|
|
+ _ = colormenu.Choose(d)
|
|
|
+ press_a_key(d)
|
|
|
case 'V':
|
|
|
// View settings
|
|
|
DisplaySettings(d)
|