m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 00:03:39 -05:00

Add experimental support for 24-bit colors

This commit is contained in:
Junegunn Choi
2017-01-10 02:16:12 +09:00
parent 340af463cd
commit ae274158de
4 changed files with 42 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package tui
import (
"strconv"
"time"
)
@@ -121,6 +122,13 @@ type ColorPair struct {
id int16
}
func HexToColor(rrggbb string) Color {
r, _ := strconv.ParseInt(rrggbb[1:3], 16, 0)
g, _ := strconv.ParseInt(rrggbb[3:5], 16, 0)
b, _ := strconv.ParseInt(rrggbb[5:7], 16, 0)
return Color((1 << 24) + (r << 16) + (g << 8) + b)
}
func NewColorPair(fg Color, bg Color) ColorPair {
return ColorPair{fg, bg, -1}
}