Skip to content

Commit e5fd280

Browse files
committed
fix(color): rgb values where out of order
1 parent 87eea6b commit e5fd280

File tree

4 files changed

+67
-9
lines changed

4 files changed

+67
-9
lines changed

examples/README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ It's intended to be used as a demonstration of features and also to track the fi
1010
| [session](session.svg) | simple terminal session running various commands like ls and cat |
1111
| [444816](444816.svg) | Asciicast recording of an equilibrium pendulum to see compatibility with asciinema files |
1212
| [444816 borderless](444816_borderless.svg) | Same as 444816 but without a terminal window |
13+
| [rgb](rgb.svg) | Sample of rgb output |
1314

1415
> Files are not embedded here to alleviate loading
1516
@@ -18,14 +19,14 @@ It's intended to be used as a demonstration of features and also to track the fi
1819
This table tracks size changes between the first release of the example and the last one as examples are updated on each code change to reflect new features and optimizations.
1920

2021
<!--SIZES_START-->
21-
22-
| File | Iterations | First Size | Current Size | Variation |
23-
| --------------------- | :--------: | ---------- | ------------ | --------- |
24-
| 256colors.svg | 2 | 954.73KB | 950.15KB | .4800% |
25-
| 444816.svg | 6 | 3.42MB | 2.92MB | 15.6300% |
26-
| 444816_borderless.svg | 2 | 3.11MB | 2.92MB | 6.1700% |
27-
| htop.svg | 4 | 74.15KB | 63.35KB | 15.7000% |
28-
| session.svg | 5 | 462.64KB | 391.84KB | 16.5700% |
22+
| File | Iterations | First Size | Current Size | Variation |
23+
|------|:----------:|------------|--------------|-----------|
24+
| 256colors.svg | 2 | 954.73KB | 950.15KB | .4800% |
25+
| 444816.svg | 6 | 3.42MB | 2.92MB | 15.6300% |
26+
| 444816_borderless.svg | 2 | 3.11MB | 2.92MB | 6.1700% |
27+
| htop.svg | 4 | 74.15KB | 63.35KB | 15.7000% |
28+
| rgb.svg | 0 | 93.29KB | 93.29KB | 0% |
29+
| session.svg | 5 | 462.64KB | 391.84KB | 16.5700% |
2930

3031
<!--SIZES_END-->
3132

examples/rgb.cast

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{"version":2,"width":94,"height":33,"timestamp":1752315249,"duration":3.54579,"env":{"SHELL":"/bin/bash","TERM":"xterm-256color"}}
2+
[0.246977,"o","\u001b[?2004h"]
3+
[0.247113,"o","\u001b]0;alv_t@founder: ~/repos/go/termsvg\u0007\u001b[01;32malv_t@founder\u001b[00m:\u001b[01;34m~/repos/go/termsvg\u001b[00m$ "]
4+
[0.50785,"o","."]
5+
[0.691627,"o","/"]
6+
[0.826325,"o","s"]
7+
[1.20804,"o","c"]
8+
[1.516782,"o","ripts/"]
9+
[1.784562,"o","r"]
10+
[2.023614,"o","gb_chart.sh "]
11+
[2.370966,"o","\r\n\u001b[?2004l\r"]
12+
[2.375934,"o","\u001b[38;2;0;0;0m██\u001b[0m\u001b[38;2;0;0;70m██\u001b[0m\u001b[38;2;0;0;140m██\u001b[0m\u001b[38;2;0;0;210m██\u001b[0m"]
13+
[2.376964,"o","\u001b[38;2;0;70;0m██\u001b[0m\u001b[38;2;0;70;70m██\u001b[0m\u001b[38;2;0;70;140m██\u001b[0m"]
14+
[2.377,"o","\u001b[38;2;0;70;210m██\u001b[0m"]
15+
[2.378292,"o","\u001b[38;2;0;140;0m██\u001b[0m\u001b[38;2;0;140;70m██\u001b[0m"]
16+
[2.378306,"o","\u001b[38;2;0;140;140m██\u001b[0m"]
17+
[2.378363,"o","\u001b[38;2;0;140;210m██\u001b[0m"]
18+
[2.3794,"o","\u001b[38;2;0;210;0m██\u001b[0m\u001b[38;2;0;210;70m██\u001b[0m"]
19+
[2.379435,"o","\u001b[38;2;0;210;140m██\u001b[0m"]
20+
[2.37948,"o","\u001b[38;2;0;210;210m██\u001b[0m"]
21+
[2.381646,"o","\u001b[38;2;70;0;0m██\u001b[0m\u001b[38;2;70;0;70m██\u001b[0m"]
22+
[2.381719,"o","\u001b[38;2;70;0;140m██\u001b[0m\u001b[38;2;70;0;210m██\u001b[0m"]
23+
[2.382816,"o","\u001b[38;2;70;70;0m██\u001b[0m\u001b[38;2;70;70;70m██\u001b[0m"]
24+
[2.382841,"o","\u001b[38;2;70;70;140m██\u001b[0m"]
25+
[2.382899,"o","\u001b[38;2;70;70;210m██\u001b[0m"]
26+
[2.383948,"o","\u001b[38;2;70;140;0m██\u001b[0m\u001b[38;2;70;140;70m██\u001b[0m\u001b[38;2;70;140;140m██\u001b[0m"]
27+
[2.384027,"o","\u001b[38;2;70;140;210m██\u001b[0m"]
28+
[2.385153,"o","\u001b[38;2;70;210;0m██\u001b[0m\u001b[38;2;70;210;70m██\u001b[0m"]
29+
[2.385195,"o","\u001b[38;2;70;210;140m██\u001b[0m"]
30+
[2.385228,"o","\u001b[38;2;70;210;210m██\u001b[0m"]
31+
[2.387406,"o","\u001b[38;2;140;0;0m██\u001b[0m\u001b[38;2;140;0;70m██\u001b[0m"]
32+
[2.387414,"o","\u001b[38;2;140;0;140m██\u001b[0m"]
33+
[2.38749,"o","\u001b[38;2;140;0;210m██\u001b[0m"]
34+
[2.388685,"o","\u001b[38;2;140;70;0m██\u001b[0m\u001b[38;2;140;70;70m██\u001b[0m"]
35+
[2.388703,"o","\u001b[38;2;140;70;140m██\u001b[0m"]
36+
[2.38878,"o","\u001b[38;2;140;70;210m██\u001b[0m"]
37+
[2.389786,"o","\u001b[38;2;140;140;0m██\u001b[0m\u001b[38;2;140;140;70m██\u001b[0m"]
38+
[2.389811,"o","\u001b[38;2;140;140;140m██\u001b[0m"]
39+
[2.389863,"o","\u001b[38;2;140;140;210m██\u001b[0m"]
40+
[2.391025,"o","\u001b[38;2;140;210;0m██\u001b[0m\u001b[38;2;140;210;70m██\u001b[0m"]
41+
[2.391101,"o","\u001b[38;2;140;210;140m██\u001b[0m\u001b[38;2;140;210;210m██\u001b[0m"]
42+
[2.393288,"o","\u001b[38;2;210;0;0m██\u001b[0m\u001b[38;2;210;0;70m██\u001b[0m"]
43+
[2.393478,"o","\u001b[38;2;210;0;140m██\u001b[0m\u001b[38;2;210;0;210m██\u001b[0m"]
44+
[2.394442,"o","\u001b[38;2;210;70;0m██\u001b[0m\u001b[38;2;210;70;70m██\u001b[0m"]
45+
[2.394522,"o","\u001b[38;2;210;70;140m██\u001b[0m\u001b[38;2;210;70;210m██\u001b[0m"]
46+
[2.395635,"o","\u001b[38;2;210;140;0m██\u001b[0m\u001b[38;2;210;140;70m██\u001b[0m"]
47+
[2.395673,"o","\u001b[38;2;210;140;140m██\u001b[0m\u001b[38;2;210;140;210m██\u001b[0m"]
48+
[2.396962,"o","\u001b[38;2;210;210;0m██\u001b[0m\u001b[38;2;210;210;70m██\u001b[0m\u001b[38;2;210;210;140m██\u001b[0m"]
49+
[2.397039,"o","\u001b[38;2;210;210;210m██\u001b[0m\r\n"]
50+
[2.415483,"o","\u001b[?2004h\u001b]0;alv_t@founder: ~/repos/go/termsvg\u0007\u001b[01;32malv_t@founder\u001b[00m:\u001b[01;34m~/repos/go/termsvg\u001b[00m$ "]
51+
[2.718767,"o","e"]
52+
[2.911637,"o","x"]
53+
[3.095297,"o","i"]
54+
[3.224075,"o","t"]
55+
[3.545682,"o","\r\n\u001b[?2004l\r"]
56+
[3.54579,"o","exit\r\n"]

examples/rgb.svg

Lines changed: 1 addition & 0 deletions
Loading

pkg/color/color.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func GetColor(c vt10x.Color) string {
1515
return colors[int(vt10x.LightGrey)]
1616
case c >= 1<<8:
1717
rgb := intToRGB(uint32(c))
18-
return fmt.Sprintf("#%02x%02x%02x", rgb.R, rgb.B, rgb.G)
18+
return fmt.Sprintf("#%02x%02x%02x", rgb.R, rgb.G, rgb.B)
1919
default:
2020
return colors[int(c)]
2121
}

0 commit comments

Comments
 (0)