File tree Expand file tree Collapse file tree 1 file changed +20
-11
lines changed
Expand file tree Collapse file tree 1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ const (
2121 defaultFg int = 39
2222 defaultBg int = 49
2323
24- // 256 color specific
2524 defaultFg256 int = - 2
2625 defaultBg256 int = - 2
2726
@@ -107,14 +106,23 @@ func (p *ansiProperties) AnsiReset() string {
107106func (p ansiProperties ) PropagateAnsiCode (previous * ansiProperties ) string {
108107
109108 if previous != nil {
110- if p .fg == defaultFg {
111- p .fg = previous .fg
112- }
113- if p .bg == defaultBg {
114- p .bg = previous .bg
115- }
116- if ! p .bold {
117- p .bold = previous .bold
109+ if colorMode == Color8 {
110+ if p .fg == defaultFg {
111+ p .fg = previous .fg
112+ }
113+ if p .bg == defaultBg {
114+ p .bg = previous .bg
115+ }
116+ if ! p .bold {
117+ p .bold = previous .bold
118+ }
119+ } else {
120+ if p .fg == defaultFg256 {
121+ p .fg = previous .fg
122+ }
123+ if p .bg == defaultBg256 {
124+ p .bg = previous .bg
125+ }
118126 }
119127 }
120128
@@ -152,16 +160,17 @@ func (p ansiProperties) PropagateAnsiCode(previous *ansiProperties) string {
152160 }
153161 }
154162 } else {
163+
155164 if p .fg > - 1 {
156165 colorCode += "\033 [38;5;" + strconv .Itoa (p .fg ) + `m`
157166 } else if p .fg == defaultFg256 {
158- colorCode += "\033 [38;5;m "
167+ colorCode += "\033 [39m "
159168 }
160169
161170 if p .bg > - 1 {
162171 colorCode += "\033 [48;5;" + strconv .Itoa (p .bg ) + `m`
163172 } else if p .bg == defaultBg256 {
164- colorCode += "\033 [48;5;m "
173+ colorCode += "\033 [49m "
165174 }
166175 }
167176
You can’t perform that action at this time.
0 commit comments