Skip to content

Commit

Permalink
remove unused and expose default color palette
Browse files Browse the repository at this point in the history
Co-authored-by: Ayman Bagabas <[email protected]>
  • Loading branch information
raphamorim and aymanbagabas committed Feb 21, 2025
1 parent 4cece45 commit 78fe515
Show file tree
Hide file tree
Showing 7 changed files with 1,491 additions and 1,492 deletions.
22 changes: 1 addition & 21 deletions ansi/sixel/color.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,10 @@ func (c Color) RGBA() (r, g, b, a uint32) {
case 2:
return sixelRGB(c.Px, c.Py, c.Pz).RGBA()
default:
return colors[c.Pc].RGBA()
return colorPalette[c.Pc].RGBA()
}
}

var colors = map[int]color.Color{
// 16 predefined color registers of VT340
0: sixelRGB(0, 0, 0),
1: sixelRGB(20, 20, 80),
2: sixelRGB(80, 13, 13),
3: sixelRGB(20, 80, 20),
4: sixelRGB(80, 20, 80),
5: sixelRGB(20, 80, 80),
6: sixelRGB(80, 80, 20),
7: sixelRGB(53, 53, 53),
8: sixelRGB(26, 26, 26),
9: sixelRGB(33, 33, 60),
10: sixelRGB(60, 26, 26),
11: sixelRGB(33, 60, 33),
12: sixelRGB(60, 33, 60),
13: sixelRGB(33, 60, 60),
14: sixelRGB(60, 60, 33),
15: sixelRGB(80, 80, 80),
}

// #define PALVAL(n,a,m) (((n) * (a) + ((m) / 2)) / (m))
func palval(n, a, m int) int {
return (n*a + m/2) / m
Expand Down
1,057 changes: 530 additions & 527 deletions ansi/sixel/decoder.go

Large diffs are not rendered by default.

Loading

0 comments on commit 78fe515

Please sign in to comment.