MrMarble / termsvg

Record, share and export your terminal as a animated SVG image.
GNU General Public License v3.0
194 stars 10 forks source link

Recordings with true color crash on export #4

Open valpackett opened 1 year ago

valpackett commented 1 year ago

with this error:

panic: runtime error: index out of range [3355443] with length 256

goroutine 1 [running]:
github.com/mrmarble/termsvg/pkg/color.GetColor(...)
        github.com/mrmarble/termsvg/pkg/color/color.go:14
github.com/mrmarble/termsvg/internal/svg.(*Canvas).getColors(0x84c1bf1c0, {0x20, 0x0, 0x1000000, 0x333333})
        github.com/mrmarble/termsvg/internal/svg/svg.go:80 +0x432
github.com/mrmarble/termsvg/internal/svg.parseCast(0x84c1bf1c0)
        github.com/mrmarble/termsvg/internal/svg/svg.go:65 +0x22b
github.com/mrmarble/termsvg/internal/svg.createCanvas(0x84c1bf420, {{0x2, 0xa0, 0x22, 0x6469703b, 0x40329f0318b9346a, 0x0, {0x0, 0x0}, {0x0, ...}, ...}, ...})
        github.com/mrmarble/termsvg/internal/svg/svg.go:47 +0x1b1
github.com/mrmarble/termsvg/internal/svg.Export({{0x2, 0xa0, 0x22, 0x6469703b, 0x40329f0318b9346a, 0x0, {0x0, 0x0}, {0x0, 0x0}, ...}, ...}, ...)
        github.com/mrmarble/termsvg/internal/svg/svg.go:39 +0xd8
github.com/mrmarble/termsvg/cmd/termsvg/export.export({0x84c014450, 0x2c}, {0x84c014570, 0x30}, 0x1)
        github.com/mrmarble/termsvg/cmd/termsvg/export/export.go:55 +0x1fb

The last commit 1f4eca4 handles >= 1<<24 but there's a lot less entries in colors, namely 256 as the error says…

MrMarble commented 5 months ago

I added support for RGB colors on the latest release, could you try again? If the error persists could you provide the cast file?