forked from sammcj/gollama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
styles.go
88 lines (77 loc) · 2.43 KB
/
styles.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// styles.go contains the styles used to render the list view.
package main
import (
"fmt"
"math"
"github.com/charmbracelet/lipgloss"
)
const (
// Define minimum column widths
minNameWidth = 14
minSizeWidth = 10
minQuantWidth = 10
minModifiedWidth = 10
minIDWidth = 10
minFamilyWidth = 14
)
var (
// Define neon colours for different model families
familyColours = map[string]lipgloss.Color{
"llama": lipgloss.Color("#FF1493"),
"alpaca": lipgloss.Color("#FF00FF"),
"bert": lipgloss.Color("#FF40CB"),
"command-r": lipgloss.Color("#FF69B4"),
"starcoder2": lipgloss.Color("#EE82EE"),
"starcoder": lipgloss.Color("#DDA0DD"),
"gemma": lipgloss.Color("#FFB6C1"),
"qwen2": lipgloss.Color("#AAE"),
"phi2": lipgloss.Color("#554AAF"),
"phi3": lipgloss.Color("#554FFF"),
"granite": lipgloss.Color("#00BFFF"),
"vicuna": lipgloss.Color("#00CED1"),
"nomic-bert": lipgloss.Color("#FF8C00"),
"qwen": lipgloss.Color("#7FFF00"),
}
// Define colour gradients
synthGradient = []string{
"#DDA0DD", "#DA70D6", "#BA55D3", "#9932CC", "#9400D3", "#8A2BE2",
"#9400D3", "#9932CC", "#BA48D3", "#DA70D6", "#DDA0DD", "#EE82EE",
"#FF00FF", "#FF0000",
}
// lipgloss.Color("#e9f"),
)
func quantColour(quant string) lipgloss.Color {
quantMap := map[string]int{
"IQ1_XXS": 0, "IQ1_XS": 0, "IQ1_S": 0, "IQ1_NL": 0,
"Q2_K": 0, "Q2_K_S": 0, "Q2_K_M": 0, "Q2_K_L": 0,
"Q3_0": 1, "IQ2_XXS": 2, "Q3_K_S": 2,
"IQ2_XS": 3, "IQ2_S": 3, "IQ2_NL": 3,
"Q3_K_M": 4, "Q3_K_L": 4,
"Q4_0": 5, "IQ3_XXS": 5, "IQ3_XS": 5, "IQ3_NL": 5, "IQ3_S": 6,
"Q4_K_S": 6, "Q4_1": 6, "IQ4_XXS": 6, "Q4_K_M": 7,
"IQ4_XS": 7, "IQ4_S": 8, "IQ4_NL": 7, "Q4_K_L": 8,
"Q5_K_S": 8, "Q5_K_M": 9, "Q5_1": 9, "Q5_K_L": 10,
"Q6_0": 11, "Q6_1": 11, "Q6_K": 11,
"Q8": 12, "Q8_0": 12, "Q8_K": 12,
"FP16": 13, "F16": 13,
}
index, exists := quantMap[quant]
if !exists {
index = 0 // Default to lightest if unknown quant
}
return lipgloss.Color(synthGradient[index])
}
func sizeColour(size float64) lipgloss.Color {
index := int(math.Log10(size+1) * 2.5)
if index >= len(synthGradient) {
index = len(synthGradient) - 1
}
return lipgloss.Color(synthGradient[index])
}
func familyColour(family string, index int) lipgloss.Color {
colour, exists := familyColours[family]
if !exists {
colour = lipgloss.Color(fmt.Sprintf("#%02X%02X%02X", 10+index%190, 10+index%190, 10+index%190))
}
return colour
}