summaryrefslogtreecommitdiffstats
path: root/src/ansi.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-11-26 00:36:38 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-11-26 00:36:38 +0900
commitde1c6b87272581eec4bfd39771e573c2bb772b60 (patch)
treeec5eedb97d634bd2cdb11fb918b7377df7d64fb1 /src/ansi.go
parent6f17f412bad6447520dd3487aa5235887cb1fd19 (diff)
[tcell] 24-bit color support
TAGS=tcell make install printf "\x1b[38;2;100;200;250mTRUECOLOR\x1b[m\n" | TERM=xterm-truecolor fzf --ansi
Diffstat (limited to 'src/ansi.go')
-rw-r--r--src/ansi.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ansi.go b/src/ansi.go
index f8fe56a1..f5506701 100644
--- a/src/ansi.go
+++ b/src/ansi.go
@@ -169,6 +169,8 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
}
case 1:
switch num {
+ case 2:
+ state256 = 10 // MAGIC
case 5:
state256++
default:
@@ -177,8 +179,20 @@ func interpretCode(ansiCode string, prevState *ansiState) *ansiState {
case 2:
*ptr = tui.Color(num)
state256 = 0
+ case 10:
+ *ptr = tui.Color(1<<24) | tui.Color(num<<16)
+ state256++
+ case 11:
+ *ptr = *ptr | tui.Color(num<<8)
+ state256++
+ case 12:
+ *ptr = *ptr | tui.Color(num)
+ state256 = 0
}
}
}
+ if state256 > 0 {
+ *ptr = -1
+ }
return state
}