|
@@ -78,10 +78,10 @@ func ParseColorArray(colorarray []int) ANSIColorParts {
|
|
|
}
|
|
|
|
|
|
// Update the LastColor with the latest codes.
|
|
|
-func (d *Door) UpdateLastColor(output string) {
|
|
|
+func (d *Door) UpdateLastColor(output string, LastColor * []int) {
|
|
|
// use the last color information + whatever is in the string to
|
|
|
// track the last color set
|
|
|
- updated := ParseColorArray(d.LastColor)
|
|
|
+ updated := ParseColorArray(*LastColor)
|
|
|
colors := find_ansicolor(output)
|
|
|
for _, codes := range colors {
|
|
|
if codes[0] == 0 {
|
|
@@ -103,19 +103,19 @@ func (d *Door) UpdateLastColor(output string) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- d.LastColor = make([]int, 1)
|
|
|
- d.LastColor[0] = 0
|
|
|
+ *LastColor = make([]int, 1)
|
|
|
+ (*LastColor)[0] = 0
|
|
|
if updated.Blink {
|
|
|
- d.LastColor = append(d.LastColor, 5)
|
|
|
+ *LastColor = append(*LastColor, 5)
|
|
|
}
|
|
|
if updated.Bold {
|
|
|
- d.LastColor = append(d.LastColor, 1)
|
|
|
+ *LastColor = append(*LastColor, 1)
|
|
|
}
|
|
|
if updated.FG != -1 {
|
|
|
- d.LastColor = append(d.LastColor, updated.FG+30)
|
|
|
+ *LastColor = append(*LastColor, updated.FG+30)
|
|
|
}
|
|
|
if updated.BG != -1 {
|
|
|
- d.LastColor = append(d.LastColor, updated.BG+40)
|
|
|
+ *LastColor = append(*LastColor, updated.BG+40)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -156,7 +156,7 @@ func (d *Door) Write(output string) {
|
|
|
if strings.HasSuffix(output, RestorePos) {
|
|
|
output += Color(d.LastColor...)
|
|
|
} else {
|
|
|
- d.UpdateLastColor(output)
|
|
|
+ d.UpdateLastColor(output, &d.LastColor)
|
|
|
}
|
|
|
|
|
|
/*
|