├── assets └── logo.png ├── mise.toml ├── .gitignore ├── pkg ├── asciicast │ ├── testdata │ │ ├── TestMarshal.golden │ │ └── TestUnmarshal.golden │ ├── event.go │ ├── event_test.go │ ├── asciicast_test.go │ └── asciicast.go ├── color │ ├── color.go │ ├── colorsgen.go │ └── colors.go └── css │ ├── css.go │ └── css_test.go ├── internal ├── svg │ ├── testdata │ │ ├── TestExportInput.golden │ │ ├── TestExportOutputNoWindow.golden │ │ └── TestExportOutput.golden │ ├── svg_test.go │ └── svg.go ├── uniqueid │ ├── uniqueid.go │ └── unique_test.go └── testutils │ └── testutils.go ├── .pre-commit-config.yaml ├── .github └── workflows │ ├── release.yml │ └── golangci-lint.yml ├── go.mod ├── .golangci.yml ├── cmd └── termsvg │ ├── play │ └── play.go │ ├── main_windows.go │ ├── main.go │ ├── export │ └── export.go │ └── rec │ └── rec.go ├── CONTRIBUTING.md ├── scripts ├── update-filesize.sh └── install-termsvg.sh ├── .goreleaser.yml ├── examples ├── README.md ├── rgb.cast ├── htop.cast ├── 256colors.cast └── session.cast ├── Taskfile.yml ├── README.md ├── go.sum └── LICENSE /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrMarble/termsvg/HEAD/assets/logo.png -------------------------------------------------------------------------------- /mise.toml: -------------------------------------------------------------------------------- 1 | [tools] 2 | go = "latest" 3 | golangci-lint = "latest" 4 | task = "latest" 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | /termsvg 3 | *.cast 4 | *.txt 5 | .task 6 | dist 7 | *.svg 8 | !examples/*.* 9 | *.bench -------------------------------------------------------------------------------- /pkg/asciicast/testdata/TestMarshal.golden: -------------------------------------------------------------------------------- 1 | {"version":2,"width":0,"height":0,"timestamp":1337,"env":{"SHELL":"TEST_SHELL","TERM":"TEST_TERM"}} 2 | [1,"o","First"] 3 | [2,"o","Second"] 4 | [3,"i","Third"] -------------------------------------------------------------------------------- /internal/svg/testdata/TestExportInput.golden: -------------------------------------------------------------------------------- 1 | {"version": 2, "width": 213, "height": 58, "timestamp": 1598646467, "env": {"SHELL": "/usr/bin/zsh", "TERM": "alacritty"}} 2 | [2.677085, "o", "h"] 3 | [2.76064, "o", "e"] 4 | [2.944434, "o", "l"] 5 | [3.111831, "o", "l"] 6 | [3.354445, "o", "o"] -------------------------------------------------------------------------------- /pkg/asciicast/testdata/TestUnmarshal.golden: -------------------------------------------------------------------------------- 1 | {"version": 2, "width": 213, "height": 58, "timestamp": 1598646467, "env": {"SHELL": "/usr/bin/zsh", "TERM": "alacritty"}} 2 | [2.677085, "o", "h"] 3 | [2.76064, "o", "e"] 4 | [2.944434, "o", "l"] 5 | [3.111831, "o", "l"] 6 | [3.354445, "o", "o"] -------------------------------------------------------------------------------- /internal/uniqueid/uniqueid.go: -------------------------------------------------------------------------------- 1 | package uniqueid 2 | 3 | type ID []rune 4 | 5 | func New() *ID { 6 | var id ID = []rune{'a'} 7 | 8 | return &id 9 | } 10 | 11 | func (id *ID) String() string { 12 | return string(*id) 13 | } 14 | 15 | func (id *ID) Next() { 16 | for i := len(*id) - 1; i >= 0; i-- { 17 | cur := (*id)[i] 18 | if cur < 'z' { 19 | (*id)[i]++ 20 | return 21 | } 22 | 23 | if i == len(*id)-1 { 24 | (*id)[i] = 'a' 25 | } 26 | 27 | if i == 0 { 28 | *id = append(*id, 'a') 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v3.2.0 4 | hooks: 5 | - id: trailing-whitespace 6 | - id: check-yaml 7 | - id: check-added-large-files 8 | - repo: https://github.com/compilerla/conventional-pre-commit 9 | rev: v1.2.0 10 | hooks: 11 | - id: conventional-pre-commit 12 | stages: [commit-msg] 13 | - repo: https://github.com/TekWizely/pre-commit-golang 14 | rev: v1.0.0-beta.5 15 | hooks: 16 | - id: go-fumpt 17 | - id: golangci-lint-mod 18 | - id: go-test-mod 19 | exclude: 'examples|testdata' -------------------------------------------------------------------------------- /pkg/color/color.go: -------------------------------------------------------------------------------- 1 | package color 2 | 3 | import ( 4 | "fmt" 5 | "image/color" 6 | 7 | "github.com/hinshun/vt10x" 8 | ) 9 | 10 | //go:generate go run colorsgen.go 11 | 12 | func GetColor(c vt10x.Color) string { 13 | switch { 14 | case c >= 1<<24: 15 | return colors[int(vt10x.LightGrey)] 16 | case c >= 1<<8: 17 | rgb := intToRGB(uint32(c)) 18 | return fmt.Sprintf("#%02x%02x%02x", rgb.R, rgb.G, rgb.B) 19 | default: 20 | return colors[int(c)] 21 | } 22 | } 23 | 24 | func intToRGB(c uint32) color.RGBA { 25 | //nolint:gosec 26 | return color.RGBA{ 27 | R: uint8(c >> 16), 28 | G: uint8(c >> 8), 29 | B: uint8(c), 30 | A: 255, 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "Release a tag" 2 | 3 | on: 4 | push: 5 | tags: 6 | - "*" 7 | 8 | permissions: 9 | contents: write 10 | 11 | jobs: 12 | release: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | with: 17 | fetch-depth: 0 18 | 19 | - name: Install Go 20 | uses: actions/setup-go@v4 21 | with: 22 | go-version: '>=1.17' 23 | 24 | - name: Create release 25 | uses: goreleaser/goreleaser-action@v5 26 | with: 27 | version: latest 28 | args: release --clean 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/mrmarble/termsvg 2 | 3 | go 1.23.0 4 | 5 | toolchain go1.24.5 6 | 7 | require ( 8 | github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b 9 | github.com/alecthomas/kong v1.12.0 10 | github.com/creack/pty v1.1.24 11 | github.com/google/go-cmp v0.7.0 12 | github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02 13 | github.com/rs/zerolog v1.34.0 14 | github.com/sebdah/goldie/v2 v2.7.1 15 | github.com/tdewolff/minify/v2 v2.23.8 16 | golang.org/x/term v0.33.0 17 | ) 18 | 19 | require ( 20 | github.com/mattn/go-colorable v0.1.13 // indirect 21 | github.com/mattn/go-isatty v0.0.19 // indirect 22 | github.com/pmezard/go-difflib v1.0.0 // indirect 23 | github.com/sergi/go-diff v1.0.0 // indirect 24 | github.com/tdewolff/parse/v2 v2.8.1 // indirect 25 | golang.org/x/sys v0.34.0 // indirect 26 | ) 27 | -------------------------------------------------------------------------------- /pkg/css/css.go: -------------------------------------------------------------------------------- 1 | package css 2 | 3 | import ( 4 | "fmt" 5 | "sort" 6 | "strings" 7 | ) 8 | 9 | type IRules interface { 10 | String() string 11 | } 12 | 13 | type Blocks []Block 14 | 15 | type Block struct { 16 | Selector string 17 | Rules IRules 18 | } 19 | 20 | type Rules map[string]string 21 | 22 | func (c Rules) String() string { 23 | var compiled []string 24 | 25 | for property, value := range c { 26 | compiled = append(compiled, fmt.Sprintf("%s:%s", property, value)) 27 | } 28 | 29 | sort.Strings(compiled) 30 | 31 | return strings.Join(compiled, ";") 32 | } 33 | 34 | func (b Block) String() string { 35 | return fmt.Sprintf("%s{%s}", b.Selector, b.Rules) 36 | } 37 | 38 | func (b Blocks) String() string { 39 | result := "" 40 | for _, block := range b { 41 | result += block.String() 42 | } 43 | 44 | return result 45 | } 46 | -------------------------------------------------------------------------------- /.github/workflows/golangci-lint.yml: -------------------------------------------------------------------------------- 1 | name: golangci-lint 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | branches: 8 | - master 9 | - main 10 | pull_request: 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | test: 17 | name: Test 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: actions/setup-go@v5 22 | with: 23 | go-version-file: go.mod 24 | - name: go mod tidy 25 | run: | 26 | go mod tidy 27 | if [ -n "$(git status --porcelain)" ]; then 28 | echo "Run 'go mod tidy' and push it" 29 | exit 1 30 | fi 31 | - name: golangci-lint 32 | uses: golangci/golangci-lint-action@v8 33 | with: 34 | version: latest 35 | - name: Run unit tests 36 | run: go test -v ./... 37 | -------------------------------------------------------------------------------- /internal/testutils/testutils.go: -------------------------------------------------------------------------------- 1 | package testutils 2 | 3 | import ( 4 | "io" 5 | "os" 6 | 7 | "github.com/google/go-cmp/cmp" 8 | ) 9 | 10 | type Helper interface { 11 | Helper() 12 | Fatalf(string, ...interface{}) 13 | } 14 | 15 | func GoldenData(t Helper, identifier string) []byte { 16 | t.Helper() 17 | 18 | goldenPath := "testdata/" + identifier + ".golden" 19 | 20 | //nolint:gosec 21 | f, err := os.Open(goldenPath) 22 | if err != nil { 23 | t.Fatalf("Error opening file %s: %s", goldenPath, err) 24 | } 25 | 26 | //nolint:errcheck 27 | defer f.Close() 28 | 29 | data, err := io.ReadAll(f) 30 | if err != nil { 31 | t.Fatalf("Error reading file %s: %s", goldenPath, err) 32 | } 33 | 34 | return data 35 | } 36 | 37 | func Diff(t Helper, x interface{}, y interface{}) { 38 | t.Helper() 39 | 40 | diff := cmp.Diff(x, y) 41 | if diff != "" { 42 | t.Fatalf(diff) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pkg/asciicast/event.go: -------------------------------------------------------------------------------- 1 | package asciicast 2 | 3 | import ( 4 | "encoding/json" 5 | ) 6 | 7 | type eventType string 8 | 9 | // Event is a 3-tuple encoded as JSON array. 10 | type Event struct { 11 | Time float64 `json:"time"` 12 | EventType eventType `json:"event-type"` 13 | EventData string `json:"event-data"` 14 | } 15 | 16 | const ( 17 | Input eventType = "i" // Data read from stdin. 18 | Output eventType = "o" // Data writed to stdout. 19 | ) 20 | 21 | // UnmarshalJSON reads json list as Event fields. 22 | func (e *Event) UnmarshalJSON(data []byte) error { 23 | var v []interface{} 24 | if err := json.Unmarshal(data, &v); err != nil { 25 | return err 26 | } 27 | 28 | e.Time = v[0].(float64) 29 | e.EventType = eventType(v[1].(string)) 30 | e.EventData = v[2].(string) 31 | 32 | return nil 33 | } 34 | 35 | // MarshalJSON reads json list as Event fields. 36 | func (e *Event) MarshalJSON() ([]byte, error) { 37 | data := [...]interface{}{e.Time, string(e.EventType), e.EventData} 38 | 39 | v, err := json.Marshal(data) 40 | if err != nil { 41 | return nil, err 42 | } 43 | 44 | return v, nil 45 | } 46 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | formatters: 4 | enable: 5 | - goimports 6 | - gci 7 | - gofumpt 8 | 9 | linters: 10 | enable: 11 | - asciicheck 12 | - bidichk 13 | - containedctx 14 | - contextcheck 15 | - gocognit 16 | - decorder 17 | - dupl 18 | - durationcheck 19 | - errchkjson 20 | - errname 21 | - errorlint 22 | - funlen 23 | - goconst 24 | - gosec 25 | - lll 26 | - misspell 27 | - revive 28 | - unconvert 29 | - gosec 30 | exclusions: 31 | rules: 32 | - linters: 33 | - revive 34 | text: "exported (type|function|const|method) .* should have comment" 35 | - linters: 36 | - revive 37 | text: "should have a package comment" 38 | - linters: 39 | - govet 40 | text: "declaration of \"err\" shadows" 41 | settings: 42 | errcheck: 43 | # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`. 44 | check-blank: true 45 | govet: 46 | enable: 47 | - shadow 48 | staticcheck: 49 | # https://staticcheck.io/docs/options#checks 50 | checks: ["all", "-ST1000"] 51 | decorder: 52 | disable-dec-order-check: false 53 | disable-init-func-first-check: false 54 | -------------------------------------------------------------------------------- /internal/uniqueid/unique_test.go: -------------------------------------------------------------------------------- 1 | package uniqueid_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/google/go-cmp/cmp" 7 | "github.com/mrmarble/termsvg/internal/uniqueid" 8 | ) 9 | 10 | func TestUniqueID(t *testing.T) { 11 | tests := map[string]struct { 12 | input string 13 | output string 14 | }{ 15 | "Initial": {uniqueid.New().String(), "a"}, 16 | "Next": {runTimes(t, 1).String(), "b"}, 17 | "10 Times": {runTimes(t, 10).String(), "k"}, 18 | "25 Times": {runTimes(t, 25).String(), "z"}, 19 | "26 Times": {runTimes(t, 26).String(), "aa"}, 20 | "27 Times": {runTimes(t, 27).String(), "ab"}, 21 | "51 Times": {runTimes(t, 51).String(), "az"}, 22 | "52 Times": {runTimes(t, 52).String(), "ba"}, 23 | "53 Times": {runTimes(t, 53).String(), "bb"}, 24 | "150 Times": {runTimes(t, 150).String(), "eu"}, 25 | "1500 Times": {runTimes(t, 1500).String(), "zzes"}, 26 | } 27 | for name, test := range tests { 28 | t.Run(name, func(t *testing.T) { 29 | diff(t, test.input, test.output) 30 | }) 31 | } 32 | } 33 | 34 | func runTimes(t *testing.T, times int) *uniqueid.ID { 35 | t.Helper() 36 | 37 | id := uniqueid.New() 38 | for i := 0; i < times; i++ { 39 | id.Next() 40 | } 41 | 42 | return id 43 | } 44 | 45 | func diff(t *testing.T, x interface{}, y interface{}) { 46 | t.Helper() 47 | 48 | diff := cmp.Diff(x, y) 49 | if diff != "" { 50 | t.Fatal(diff) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /cmd/termsvg/play/play.go: -------------------------------------------------------------------------------- 1 | package play 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "time" 8 | 9 | "github.com/mrmarble/termsvg/pkg/asciicast" 10 | ) 11 | 12 | type Cmd struct { 13 | File string `arg:"" type:"existingfile" help:"termsvg recording file"` 14 | Speed float64 `optional:"" short:"s" default:"1.0" help:"Playback speed (can be fractional)"` 15 | IdleCap float64 `optional:"" short:"i" default:"-1.0" help:"Limit replayed terminal inactivity to max seconds. (-1 for unlimited)"` //nolint 16 | } 17 | 18 | func (cmd *Cmd) Run() error { 19 | return play(cmd.File, cmd.IdleCap, cmd.Speed) 20 | } 21 | 22 | func play(path string, idleCap, speed float64) error { 23 | file, err := os.ReadFile(filepath.Clean(path)) 24 | if err != nil { 25 | return err 26 | } 27 | 28 | records, err := asciicast.Unmarshal(file) 29 | if err != nil { 30 | return err 31 | } 32 | 33 | records.ToRelativeTime() 34 | records.CapRelativeTime(idleCap) 35 | records.ToAbsoluteTime() 36 | records.AdjustSpeed(speed) 37 | 38 | baseTime := time.Duration(time.Now().UnixMilli()) * time.Millisecond 39 | 40 | for _, record := range records.Events { 41 | duration := time.Duration(record.Time * float64(time.Second)) 42 | 43 | delay := duration - ((time.Duration(time.Now().UnixMilli()) * time.Millisecond) - baseTime) 44 | 45 | time.Sleep(delay) 46 | fmt.Print(record.EventData) 47 | } 48 | 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /internal/svg/testdata/TestExportOutputNoWindow.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 14 | 15 | h 16 | 17 | 18 | he 19 | 20 | 21 | hel 22 | 23 | 24 | hell 25 | 26 | 27 | hello 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /pkg/css/css_test.go: -------------------------------------------------------------------------------- 1 | package css_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/mrmarble/termsvg/internal/testutils" 7 | "github.com/mrmarble/termsvg/pkg/css" 8 | ) 9 | 10 | func TestRules(t *testing.T) { 11 | tests := map[string]struct { 12 | input css.Rules 13 | output string 14 | }{ 15 | "Single rule": {css.Rules{"transform": "translate(10)"}, "transform:translate(10)"}, 16 | "Multiple rule": {css.Rules{ 17 | "transform": "translate(10)", 18 | "animation-iteration-count": "infinite", 19 | }, "animation-iteration-count:infinite;transform:translate(10)"}, 20 | } 21 | 22 | for name, test := range tests { 23 | t.Run(name, func(t *testing.T) { 24 | testutils.Diff(t, test.input.String(), test.output) 25 | }) 26 | } 27 | } 28 | 29 | func TestBlock(t *testing.T) { 30 | tests := map[string]struct { 31 | input css.Block 32 | output string 33 | }{ 34 | "Single rule": {css.Block{".class", css.Rules{"transform": "translate(10)"}}, ".class{transform:translate(10)}"}, 35 | "Multiple rule": {css.Block{ 36 | ".class", 37 | css.Rules{ 38 | "transform": "translate(10)", 39 | "animation-iteration-count": "infinite", 40 | }, 41 | }, ".class{animation-iteration-count:infinite;transform:translate(10)}"}, 42 | } 43 | 44 | for name, test := range tests { 45 | t.Run(name, func(t *testing.T) { 46 | testutils.Diff(t, test.input.String(), test.output) 47 | }) 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to TermSVG 2 | 3 | ## Reporting bugs 4 | 5 | Open an issue in GitHub issue tracker. 6 | 7 | Tell me what's the problem and include steps to reproduce it (reliably). 8 | Including your OS/browser/terminal name and version in the report would be 9 | great. 10 | 11 | ## Submitting patches with bug fixes 12 | 13 | If you found a bug and made a patch for it: 14 | 15 | 1. Make sure your changes pass the [pre-commit](https://pre-commit.com/) 16 | [hooks](.pre-commit-config.yaml). You can install the hooks in your work 17 | tree by running `task setup` in your checked out copy. 18 | 1. Make sure all tests pass. If you add new functionality, add new tests. 19 | 1. Send a pull request, including a description of the fix (referencing an 20 | existing issue if there's one). 21 | 22 | ## Requesting new features 23 | 24 | I'm open to ideas. 25 | 26 | If you believe most termsvg users would benefit from implementing your idea 27 | then feel free to open a GitHub issue. However, as this is an open-source 28 | project maintained by just one person I simply can't implement all 29 | of them due to limited resources. Please keep that in mind. 30 | 31 | ## Proposing features/changes (pull requests) 32 | 33 | If you want to propose code change, either introducing a new feature or 34 | improving an existing one, please first discuss it first. You 35 | can simply open a separate issue for a discussion. 36 | 37 | ## Asking for help 38 | 39 | GitHub issue tracker is not a support forum but I'll do my best. 40 | -------------------------------------------------------------------------------- /internal/svg/svg_test.go: -------------------------------------------------------------------------------- 1 | package svg_test 2 | 3 | import ( 4 | "bytes" 5 | "testing" 6 | 7 | "github.com/mrmarble/termsvg/internal/svg" 8 | "github.com/mrmarble/termsvg/internal/testutils" 9 | "github.com/mrmarble/termsvg/pkg/asciicast" 10 | "github.com/sebdah/goldie/v2" 11 | ) 12 | 13 | func TestExport(t *testing.T) { 14 | input := testutils.GoldenData(t, "TestExportInput") 15 | 16 | cast, err := asciicast.Unmarshal(input) 17 | if err != nil { 18 | t.Fatal(err) 19 | } 20 | 21 | var output bytes.Buffer 22 | 23 | // Pass empty override bg and text colors 24 | svg.Export(*cast, &output, "", "", false) 25 | 26 | g := goldie.New(t) 27 | g.Assert(t, "TestExportOutput", output.Bytes()) 28 | } 29 | 30 | func TestNoWindow(t *testing.T) { 31 | input := testutils.GoldenData(t, "TestExportInput") 32 | 33 | cast, err := asciicast.Unmarshal(input) 34 | if err != nil { 35 | t.Fatal(err) 36 | } 37 | 38 | var output bytes.Buffer 39 | 40 | // Pass empty override bg and text colors 41 | svg.Export(*cast, &output, "", "", true) 42 | 43 | g := goldie.New(t) 44 | g.Assert(t, "TestExportOutputNoWindow", output.Bytes()) 45 | } 46 | 47 | func BenchmarkExport(b *testing.B) { 48 | input := testutils.GoldenData(b, "TestExportInput") 49 | 50 | cast, err := asciicast.Unmarshal(input) 51 | if err != nil { 52 | b.Fatal(err) 53 | } 54 | 55 | for i := 0; i < b.N; i++ { 56 | var output bytes.Buffer 57 | 58 | // Pass empty override bg and text colors 59 | svg.Export(*cast, &output, "", "", false) 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /internal/svg/testdata/TestExportOutput.golden: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | h 19 | 20 | 21 | he 22 | 23 | 24 | hel 25 | 26 | 27 | hell 28 | 29 | 30 | hello 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /cmd/termsvg/main_windows.go: -------------------------------------------------------------------------------- 1 | //go:build windows 2 | 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | 9 | "github.com/alecthomas/kong" 10 | "github.com/mrmarble/termsvg/cmd/termsvg/export" 11 | "github.com/mrmarble/termsvg/cmd/termsvg/play" 12 | "github.com/rs/zerolog" 13 | "github.com/rs/zerolog/log" 14 | ) 15 | 16 | type Context struct { 17 | Debug bool 18 | } 19 | 20 | type VersionFlag string 21 | 22 | var ( 23 | // Populated by goreleaser during build 24 | version = "master" 25 | commit = "?" 26 | date = "" 27 | ) 28 | 29 | func init() { 30 | zerolog.SetGlobalLevel(zerolog.InfoLevel) 31 | 32 | log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, PartsExclude: []string{"time"}}) 33 | } 34 | 35 | func (v VersionFlag) Decode(_ *kong.DecodeContext) error { return nil } 36 | func (v VersionFlag) IsBool() bool { return true } 37 | func (v VersionFlag) BeforeApply(app *kong.Kong) error { 38 | fmt.Printf("termsvg has version %s built from %s on %s\n", version, commit, date) 39 | app.Exit(0) 40 | 41 | return nil 42 | } 43 | 44 | func main() { 45 | var cli struct { 46 | Debug bool `help:"Enable debug mode."` 47 | Version VersionFlag `name:"version" help:"Print version information and quit"` 48 | 49 | Play play.Cmd `cmd:"" help:"Play a recording."` 50 | Export export.Cmd `cmd:"" help:"Export asciicast."` 51 | } 52 | 53 | ctx := kong.Parse(&cli, 54 | kong.Name("termsvg"), 55 | kong.Description("A cli tool for recording terminal sessions"), 56 | kong.UsageOnError()) 57 | // Call the Run() method of the selected parsed command. 58 | err := ctx.Run(&Context{Debug: cli.Debug}) 59 | ctx.FatalIfErrorf(err) 60 | } 61 | -------------------------------------------------------------------------------- /scripts/update-filesize.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Root folder using git 4 | BASE_PATH=$(git rev-parse --show-toplevel) 5 | 6 | EXAMPLES_FOLDER="$BASE_PATH/examples" 7 | SVG_FILES="$EXAMPLES_FOLDER/*.svg" 8 | 9 | # Markdown table header 10 | read -r -d '' TABLE << EOS 11 | | File | Iterations | First Size | Current Size | Variation | 12 | |------|:----------:|------------|--------------|-----------|\n 13 | EOS 14 | 15 | 16 | for filepath in $SVG_FILES; do 17 | filename=$(basename $filepath) 18 | 19 | # Get git commit hash history for file 20 | blobs=$(git rev-list --all examples/$filename) 21 | 22 | formated_sizes=() 23 | raw_sizes=() 24 | for blob in $blobs; do 25 | # Join commit hash with file path 26 | gittag="$blob:examples/$filename" 27 | 28 | # Obtain file size history in bytes 29 | bytes=$(git cat-file -s $gittag) 30 | raw_sizes+=($bytes) 31 | 32 | # Format bytes to human readable sizes 33 | formated_sizes+=($(numfmt --to=si --suffix=B --format=%.2f $bytes)) 34 | done 35 | 36 | first=${raw_sizes[-1]} 37 | current=${raw_sizes[0]} 38 | 39 | # Calculate variation percent using bc to suport floating point 40 | variation=`echo "scale=4; (($first-$current)/(($first+$current)/2))*100" | bc` 41 | 42 | # Append row to table 43 | TABLE+="| $filename | ${#formated_sizes[@]} | ${formated_sizes[-1]} | ${formated_sizes[0]} | $variation% |\n" 44 | done 45 | 46 | lead='' 47 | tail='' 48 | 49 | # Replace markers with table 50 | new_readme=$(sed -n "/$lead/{p;:a;N;/$tail/!ba;s/.*\n/${TABLE//$'\n'/\\n}\n/};p" $EXAMPLES_FOLDER/README.md) 51 | echo "$new_readme" > $EXAMPLES_FOLDER/README.md -------------------------------------------------------------------------------- /cmd/termsvg/main.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | 9 | "github.com/alecthomas/kong" 10 | "github.com/mrmarble/termsvg/cmd/termsvg/export" 11 | "github.com/mrmarble/termsvg/cmd/termsvg/play" 12 | "github.com/mrmarble/termsvg/cmd/termsvg/rec" 13 | "github.com/rs/zerolog" 14 | "github.com/rs/zerolog/log" 15 | ) 16 | 17 | type Context struct { 18 | Debug bool 19 | } 20 | 21 | type VersionFlag string 22 | 23 | var ( 24 | // Populated by goreleaser during build 25 | version = "master" 26 | commit = "?" 27 | date = "" 28 | ) 29 | 30 | func init() { 31 | zerolog.SetGlobalLevel(zerolog.InfoLevel) 32 | 33 | log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr, PartsExclude: []string{"time"}}) 34 | } 35 | 36 | func (v VersionFlag) Decode(_ *kong.DecodeContext) error { return nil } 37 | func (v VersionFlag) IsBool() bool { return true } 38 | func (v VersionFlag) BeforeApply(app *kong.Kong) error { 39 | fmt.Printf("termsvg has version %s built from %s on %s\n", version, commit, date) 40 | app.Exit(0) 41 | 42 | return nil 43 | } 44 | 45 | func main() { 46 | var cli struct { 47 | Debug bool `help:"Enable debug mode."` 48 | Version VersionFlag `name:"version" help:"Print version information and quit"` 49 | 50 | Play play.Cmd `cmd:"" help:"Play a recording."` 51 | Rec rec.Cmd `cmd:"" help:"Record a terminal sesion."` 52 | Export export.Cmd `cmd:"" help:"Export asciicast."` 53 | } 54 | 55 | ctx := kong.Parse(&cli, 56 | kong.Name("termsvg"), 57 | kong.Description("A cli tool for recording terminal sessions"), 58 | kong.UsageOnError()) 59 | // Call the Run() method of the selected parsed command. 60 | err := ctx.Run(&Context{Debug: cli.Debug}) 61 | ctx.FatalIfErrorf(err) 62 | } 63 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | version: 1 2 | 3 | project_name: termsvg 4 | 5 | before: 6 | hooks: 7 | - go mod tidy 8 | 9 | release: 10 | github: 11 | owner: mrmarble 12 | name: termsvg 13 | 14 | builds: 15 | - binary: termsvg 16 | env: 17 | - CGO_ENABLED=0 18 | goos: 19 | - linux 20 | - darwin 21 | - freebsd 22 | - windows 23 | goarch: 24 | - amd64 25 | - arm64 26 | - arm 27 | - "386" 28 | goarm: 29 | - "6" 30 | - "7" 31 | ignore: 32 | - goos: darwin 33 | goarch: "386" 34 | - goos: freebsd 35 | goarch: arm64 36 | - goos: windows 37 | goarch: arm64 38 | - goos: windows 39 | goarch: "arm" 40 | - goos: windows 41 | goarch: "386" 42 | 43 | flags: 44 | - -trimpath 45 | ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.CommitDate}} 46 | gcflags: 47 | - all=-l -B 48 | mod_timestamp: '{{ .CommitTimestamp }}' 49 | main: ./cmd/termsvg 50 | 51 | archives: 52 | - format: tar.gz 53 | wrap_in_directory: true 54 | format_overrides: 55 | - goos: darwin 56 | format: zip 57 | - goos: windows 58 | format: zip 59 | name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' 60 | files: 61 | - LICENSE 62 | - README.md 63 | 64 | checksum: 65 | name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt' 66 | 67 | snapshot: 68 | name_template: SNAPSHOT-{{ .Commit }} 69 | 70 | changelog: 71 | sort: asc 72 | filters: 73 | exclude: 74 | - '^docs:' 75 | - '^test:' 76 | groups: 77 | - title: Features 78 | regexp: "^.*feat[(\\w)]*:+.*$" 79 | order: 0 80 | - title: 'Bug fixes' 81 | regexp: "^.*fix[(\\w)]*:+.*$" 82 | order: 1 83 | - title: Others 84 | order: 999 -------------------------------------------------------------------------------- /pkg/asciicast/event_test.go: -------------------------------------------------------------------------------- 1 | package asciicast_test 2 | 3 | import ( 4 | "encoding/json" 5 | "testing" 6 | 7 | "github.com/google/go-cmp/cmp" 8 | "github.com/mrmarble/termsvg/pkg/asciicast" 9 | ) 10 | 11 | func TestJSONMarshal(t *testing.T) { 12 | tests := map[string]struct { 13 | input asciicast.Event 14 | output string 15 | }{ 16 | "Input event": { 17 | input: asciicast.Event{ 18 | Time: 0.05, 19 | EventType: asciicast.Input, 20 | EventData: "input", 21 | }, 22 | output: `[0.05,"i","input"]`, 23 | }, 24 | "Output event": { 25 | input: asciicast.Event{ 26 | Time: 0.25, 27 | EventType: asciicast.Output, EventData: "output", 28 | }, 29 | output: `[0.25,"o","output"]`, 30 | }, 31 | } 32 | for name, tc := range tests { 33 | t.Run(name, func(t *testing.T) { 34 | input := tc.input 35 | 36 | output, err := json.Marshal(&input) 37 | if err != nil { 38 | t.Fatal(err) 39 | } 40 | 41 | diff := cmp.Diff(string(output), tc.output) 42 | if diff != "" { 43 | t.Fatal(diff) 44 | } 45 | }) 46 | } 47 | } 48 | 49 | func TestJSONUnmarshal(t *testing.T) { 50 | tests := map[string]struct { 51 | input string 52 | output asciicast.Event 53 | }{ 54 | "Input event": { 55 | output: asciicast.Event{ 56 | Time: 0.05, 57 | EventType: asciicast.Input, 58 | EventData: "input", 59 | }, 60 | input: `[0.05,"i","input"]`, 61 | }, 62 | "Output event": { 63 | output: asciicast.Event{ 64 | Time: 0.25, 65 | EventType: asciicast.Output, EventData: "output", 66 | }, 67 | input: `[0.25,"o","output"]`, 68 | }, 69 | } 70 | for name, tc := range tests { 71 | t.Run(name, func(t *testing.T) { 72 | var output asciicast.Event 73 | err := json.Unmarshal([]byte(tc.input), &output) 74 | if err != nil { 75 | t.Fatal(err) 76 | } 77 | diff := cmp.Diff(output, tc.output) 78 | if diff != "" { 79 | t.Fatal(diff) 80 | } 81 | }) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | This folder contains some examples of recordings and exports. 4 | It's intended to be used as a demonstration of features and also to track the file size. 5 | 6 | | Example | Description | 7 | | ------------------------------------------ | ---------------------------------------------------------------------------------------- | 8 | | [256colors](256colors.svg) | script to print the 256 xterm colors as background and foreground | 9 | | [htop](htop.svg) | running htop to see progress bars, headers and pagination | 10 | | [session](session.svg) | simple terminal session running various commands like ls and cat | 11 | | [444816](444816.svg) | Asciicast recording of an equilibrium pendulum to see compatibility with asciinema files | 12 | | [444816 borderless](444816_borderless.svg) | Same as 444816 but without a terminal window | 13 | | [rgb](rgb.svg) | Sample of rgb output | 14 | 15 | > Files are not embedded here to alleviate loading 16 | 17 | ## Sizes 18 | 19 | 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. 20 | 21 | 22 | | File | Iterations | First Size | Current Size | Variation | 23 | |------|:----------:|------------|--------------|-----------| 24 | | 256colors.svg | 3 | 954.73kB | 1.08MB | -12.1900% | 25 | | 444816_borderless.svg | 2 | 3.11MB | 2.92MB | 6.1700% | 26 | | 444816.svg | 7 | 3.42MB | 2.92MB | 15.6200% | 27 | | htop.svg | 5 | 74.15kB | 82.72kB | -10.9300% | 28 | | rgb.svg | 3 | 95.53kB | 133.83kB | -33.3900% | 29 | | session.svg | 6 | 462.64kB | 424.09kB | 8.6900% | 30 | 31 | 32 | 33 | > Table generated using [update-filesize.sh](/scripts/update-filesize.sh) script 34 | -------------------------------------------------------------------------------- /cmd/termsvg/export/export.go: -------------------------------------------------------------------------------- 1 | package export 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "path/filepath" 7 | 8 | "github.com/mrmarble/termsvg/internal/svg" 9 | "github.com/mrmarble/termsvg/pkg/asciicast" 10 | "github.com/rs/zerolog/log" 11 | "github.com/tdewolff/minify/v2" 12 | msvg "github.com/tdewolff/minify/v2/svg" 13 | ) 14 | 15 | type Cmd struct { 16 | File string `arg:"" type:"existingfile" help:"asciicast file to export"` 17 | Output string `optional:"" short:"o" type:"path" help:"where to save the file. Defaults to .svg"` 18 | Mini bool `name:"minify" optional:"" short:"m" help:"minify output file. May be slower"` 19 | NoWindow bool `name:"nowindow" optional:"" short:"n" help:"don't render terminal window in svg"` 20 | BackgroundColor string `optional:"" short:"b" help:"background color in hexadecimal format (e.g. #FFFFFF)"` 21 | TextColor string `optional:"" short:"t" help:"text color in hexadecimal format (e.g. #000000)"` 22 | } 23 | 24 | func (cmd *Cmd) Run() error { 25 | output := cmd.Output 26 | if output == "" { 27 | output = cmd.File + ".svg" 28 | } 29 | 30 | err := export(cmd.File, output, cmd.Mini, cmd.BackgroundColor, cmd.TextColor, cmd.NoWindow) 31 | if err != nil { 32 | return err 33 | } 34 | 35 | log.Info().Str("output", output).Msg("svg file saved.") 36 | 37 | return nil 38 | } 39 | 40 | func export(input, output string, mini bool, bgColor, textColor string, noWindow bool) error { 41 | inputFile, err := os.ReadFile(filepath.Clean(input)) 42 | if err != nil { 43 | return err 44 | } 45 | 46 | cast, err := asciicast.Unmarshal(inputFile) 47 | if err != nil { 48 | return err 49 | } 50 | 51 | out := new(bytes.Buffer) 52 | var data []byte 53 | 54 | svg.Export(*cast, out, bgColor, textColor, noWindow) 55 | if mini { 56 | m := minify.New() 57 | m.AddFunc("image/svg+xml", msvg.Minify) 58 | b, err := m.Bytes("image/svg+xml", out.Bytes()) 59 | if err != nil { 60 | return err 61 | } 62 | data = b 63 | } else { 64 | data = out.Bytes() 65 | } 66 | outputFile, err := os.Create(output) 67 | if err != nil { 68 | return err 69 | } 70 | _, err = outputFile.Write(data) 71 | if err != nil { 72 | //nolint:gosec,errcheck 73 | outputFile.Close() 74 | return err 75 | } 76 | 77 | return outputFile.Close() 78 | } 79 | -------------------------------------------------------------------------------- /Taskfile.yml: -------------------------------------------------------------------------------- 1 | # https://taskfile.dev 2 | 3 | version: "3" 4 | 5 | env: 6 | GO111MODULE: on 7 | GOPROXY: https://proxy.golang.org,direct 8 | 9 | tasks: 10 | setup: 11 | desc: Prepare development environment 12 | cmds: 13 | - go install mvdan.cc/gofumpt@latest 14 | - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest 15 | - go install github.com/goreleaser/goreleaser@latest 16 | - pre-commit install 17 | - pre-commit install --hook-type commit-msg 18 | - go mod tidy 19 | 20 | build: 21 | desc: Build the binary 22 | sources: 23 | - ./**/*.go 24 | generates: 25 | - ./goreleaser 26 | cmds: 27 | - go build ./cmd/termsvg 28 | 29 | test: 30 | desc: Run tests 31 | env: 32 | LC_ALL: C 33 | vars: 34 | TEST_OPTIONS: '{{default "" .TEST_OPTIONS}}' 35 | SOURCE_FILES: '{{default "./..." .SOURCE_FILES}}' 36 | TEST_PATTERN: '{{default "." .TEST_PATTERN}}' 37 | cmds: 38 | - go test {{.TEST_OPTIONS}} -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt {{.SOURCE_FILES}} -run {{.TEST_PATTERN}} -timeout=5m 39 | 40 | cover: 41 | desc: Open the cover tool 42 | cmds: 43 | - go tool cover -html=coverage.txt 44 | 45 | fmt: 46 | desc: gofumpt all code 47 | cmds: 48 | - gofumpt -w -l . 49 | 50 | lint: 51 | desc: Lint the code with golangci-lint 52 | cmds: 53 | - golangci-lint run --fix ./... 54 | 55 | ci: 56 | desc: Run all CI steps 57 | cmds: 58 | - task: lint 59 | - task: test 60 | - task: build 61 | 62 | default: 63 | desc: Runs the default tasks 64 | cmds: 65 | - task: ci 66 | 67 | release: 68 | desc: Create a new tag 69 | vars: 70 | NEXT: 71 | sh: svu n 72 | cmds: 73 | - git tag {{.NEXT}} 74 | - echo {{.NEXT}} 75 | - git push origin --tags 76 | 77 | examples: 78 | desc: Regenerate examples 79 | deps: 80 | - build 81 | sources: 82 | - ./examples/*.cast 83 | - ./termsvg 84 | generates: 85 | - ./examples/*.svg 86 | cmds: 87 | - for f in ./examples/*.cast; do ./termsvg export "$f" -m -o "${f%.cast}.svg"; done 88 | - ./scripts/update-filesize.sh 89 | goreleaser: 90 | desc: Run GoReleaser either in snapshot or release mode 91 | deps: 92 | - build 93 | vars: 94 | SNAPSHOT: 95 | sh: 'if [[ $GITHUB_REF != refs/tags/v* ]]; then echo "--snapshot"; fi' 96 | cmds: 97 | - goreleaser release --rm-dist {{.SNAPSHOT}} 98 | 99 | -------------------------------------------------------------------------------- /pkg/color/colorsgen.go: -------------------------------------------------------------------------------- 1 | // The following directive is necessary to make the package coherent: 2 | 3 | //go:build ignore 4 | // +build ignore 5 | 6 | // This program generates xtermcolors.go. It can be invoked by running 7 | // go generate 8 | package main 9 | 10 | import ( 11 | "fmt" 12 | "image/color" 13 | "log" 14 | "os" 15 | "strconv" 16 | "text/template" 17 | "time" 18 | ) 19 | 20 | var customFuncs = template.FuncMap{ 21 | "inc": func(i int) int { 22 | return i + 16 23 | }, 24 | "hex": func(c color.Color) string { 25 | r, g, b, _ := c.RGBA() 26 | return fmt.Sprintf("#%02x%02x%02x", uint8(r), uint8(g), uint8(b)) 27 | }, 28 | "colon": func(i int) string { 29 | return strconv.Itoa(i) + ":" 30 | }, 31 | } 32 | 33 | var packageTemplate = template.Must(template.New("").Funcs(customFuncs).Parse(`// Code generated by go generate; DO NOT EDIT. 34 | // This file was generated by robots at 35 | // {{ .Timestamp }} 36 | package color 37 | 38 | var colors = []string{ 39 | // ANSI colors 40 | {{- range $index, $element := .AnsiColors }} 41 | {{ printf "%-4s%q" (colon $index) (hex $element)}}, 42 | {{- end }} 43 | 44 | // XTERM colors 45 | {{- range $index, $element := .XtermColors }} 46 | {{ printf "%-5s%q" (colon (inc $index)) $element}}, 47 | {{- end }} 48 | } 49 | `)) 50 | 51 | var ansiColors = []color.Color{ 52 | color.Black, // Black 53 | color.RGBA{0x00CD, 0x00, 0x00, 0x00}, // Red 54 | color.RGBA{0x00, 0x00CD, 0x00, 0x00}, // Green 55 | color.RGBA{0x00CD, 0x00CD, 0x00, 0x00}, // Yellow 56 | color.RGBA{0x00, 0x00, 0x00EE, 0x00}, // Blue 57 | color.RGBA{0x00CD, 0x00, 0x00CD, 0x00}, // Magent 58 | color.RGBA{0x00, 0x00CD, 0x00CD, 0x00}, // Cyan 59 | color.RGBA{0x00E5, 0x00E5, 0x00E5, 0x00}, // Grey 60 | 61 | color.RGBA{0x007F, 0x007F, 0x007F, 0x00}, // Dark Grey 62 | color.RGBA{0x00FF, 0x00, 0x00, 0x00}, // Light Red 63 | color.RGBA{0x00, 0x00FF, 0x00, 0x00}, // Light Green 64 | color.RGBA{0x00FF, 0x00FF, 0x00, 0x00}, // Light Yellow 65 | color.RGBA{0x005C, 0x005C, 0x00FF, 0x00}, // Light Blue 66 | color.RGBA{0x00FF, 0x00, 0x00FF, 0x00}, // Light Magent 67 | color.RGBA{0x00, 0x00FF, 0x00FF, 0x00}, // Light Cyan 68 | color.White, // White 69 | } 70 | 71 | func main() { 72 | f, err := os.Create("colors.go") 73 | if err != nil { 74 | log.Fatal(err) 75 | } 76 | defer f.Close() 77 | 78 | colored := []int{0} 79 | for i := 95; i < 256; i += 40 { 80 | colored = append(colored, i) 81 | } 82 | 83 | colorPalette := []string{} 84 | 85 | for _, r := range colored { 86 | for _, g := range colored { 87 | for _, b := range colored { 88 | colorPalette = append(colorPalette, fmt.Sprintf("#%02x%02x%02x", r, g, b)) 89 | } 90 | } 91 | } 92 | 93 | grayscale := []int{} 94 | for i := 8; i < 240; i += 10 { 95 | grayscale = append(grayscale, i) 96 | } 97 | 98 | grayscalePalette := []string{} 99 | for _, rgb := range grayscale { 100 | grayscalePalette = append(grayscalePalette, fmt.Sprintf("#%02x%02x%02x", rgb, rgb, rgb)) 101 | } 102 | 103 | colors := append(colorPalette, grayscalePalette...) 104 | 105 | packageTemplate.Execute(f, struct { 106 | Timestamp time.Time 107 | XtermColors []string 108 | AnsiColors []color.Color 109 | }{ 110 | Timestamp: time.Now(), 111 | XtermColors: colors, 112 | AnsiColors: ansiColors, 113 | }) 114 | } 115 | -------------------------------------------------------------------------------- /scripts/install-termsvg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function get_termsvg() { 4 | local DIST="" 5 | local EXT="" 6 | local FILENAME="" 7 | local KERNEL="" 8 | local MACHINE="" 9 | local TMP_DIR="" 10 | local URL="" 11 | local TAG="" 12 | local VER="" 13 | 14 | # Get the current released tag_name 15 | TAG=$(curl -sL https://api.github.com/repos/mrmarble/termsvg/releases \ 16 | | grep tag_name | head -n1 | cut -d'"' -f4) 17 | 18 | if [ -n "${TAG}" ]; then 19 | URL="https://github.com/MrMarble/termsvg/releases/download/${TAG}" 20 | VER="${TAG:1}" 21 | else 22 | echo "ERROR! Could not retrieve the current termsvg version number." 23 | exit 1 24 | fi 25 | 26 | # Get kernel name and machine architecture. 27 | KERNEL=$(uname -s) 28 | MACHINE=$(uname -m) 29 | 30 | # Determine the target distrubution 31 | if [ "${KERNEL}" == "Linux" ]; then 32 | EXT="tar.gz" 33 | if [ "${MACHINE}" == "i386" ]; then 34 | DIST="linux-386" 35 | elif [ "${MACHINE}" == "x86_64" ]; then 36 | DIST="linux-amd64" 37 | elif [ "${MACHINE}" == "armv6l" ]; then 38 | DIST="linux-armv6" 39 | elif [ "${MACHINE}" == "armv7l" ]; then 40 | DIST="linux-armv7" 41 | elif [ "${MACHINE}" == "aarch64" ]; then 42 | DIST="linux-arm64" 43 | fi 44 | elif [ "${KERNEL}" == "Darwin" ]; then 45 | EXT="zip" 46 | if [ "${MACHINE}" == "x86_64" ]; then 47 | DIST="darwin-amd64" 48 | elif [ "${MACHINE}" == "arm64" ]; then 49 | DIST="darwin-arm64" 50 | fi 51 | elif [ "${KERNEL}" == "FreeBSD" ]; then 52 | EXT="tar.gz" 53 | if [ "${MACHINE}" == "i386" ]; then 54 | DIST="freebsd-386" 55 | elif [ "${MACHINE}" == "x86_64" ]; then 56 | DIST="freebsd-amd64" 57 | elif [ "${MACHINE}" == "armv6l" ]; then 58 | DIST="freebsd-armv6" 59 | elif [ "${MACHINE}" == "armv7l" ]; then 60 | DIST="freebsd-armv7" 61 | fi 62 | else 63 | echo "ERROR! ${KERNEL} is not a supported platform." 64 | exit 1 65 | fi 66 | 67 | # Was a known distribution detected? 68 | if [ -z "${DIST}" ]; then 69 | echo "ERROR! ${MACHINE} is not a supported architecture." 70 | exit 1 71 | fi 72 | 73 | # Derive the filename 74 | FILENAME="termsvg-${VER}-${DIST}.${EXT}" 75 | 76 | echo " - Downloading ${URL}/${FILENAME}" 77 | TMP_DIR=$(mktemp -d -t termsvg-install-XXXX) 78 | curl -sLo "${TMP_DIR}/${FILENAME}" "${URL}/${FILENAME}" 79 | 80 | echo " - Unpacking ${FILENAME}" 81 | if [ "${EXT}" == "zip" ]; then 82 | unzip -qq -o "${TMP_DIR}/${FILENAME}" -d "${TMP_DIR}" 83 | elif [ "${EXT}" == "tar.gz" ]; then 84 | tar -xf "${TMP_DIR}/${FILENAME}" --directory "${TMP_DIR}" 85 | else 86 | echo "ERROR! Unexpected file extension." 87 | exit 1 88 | fi 89 | 90 | # /usr/local/bin should be present on Linux and macOS hosts. Just be sure. 91 | if [ -d /usr/local/bin ]; then 92 | echo " - Placing termsvg in /usr/local/bin" 93 | mv "${TMP_DIR}/termsvg-${VER}-${DIST}/termsvg" /usr/local/bin/ 94 | chmod +x /usr/local/bin/termsvg 95 | 96 | echo " - Cleaning up" 97 | rm -rf "${TMP_DIR}" 98 | echo -en " - " 99 | termsvg --version 100 | else 101 | echo "ERROR! /usr/local/bin is not present. Install aborted." 102 | rm -rf "${TMP_DIR}" 103 | exit 1 104 | fi 105 | 106 | } 107 | 108 | echo "termsvg scripted install" 109 | 110 | if [ "$(id -u)" -ne 0 ]; then 111 | echo "ERROR! You must run this script as root." 112 | exit 1 113 | fi 114 | 115 | get_termsvg 116 | -------------------------------------------------------------------------------- /pkg/asciicast/asciicast_test.go: -------------------------------------------------------------------------------- 1 | package asciicast_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/mrmarble/termsvg/internal/testutils" 7 | "github.com/mrmarble/termsvg/pkg/asciicast" 8 | "github.com/sebdah/goldie/v2" 9 | ) 10 | 11 | func TestReadRecords(t *testing.T) { 12 | golden := testutils.GoldenData(t, "TestUnmarshal") 13 | 14 | record, err := asciicast.Unmarshal(golden) 15 | if err != nil { 16 | t.Fatalf("Error reading: %v", err) 17 | } 18 | 19 | tests := map[string]struct { 20 | input interface{} 21 | output interface{} 22 | }{ 23 | "Version": {input: record.Header.Version, output: 2}, 24 | "Width": {input: record.Header.Width, output: 213}, 25 | "Height": {input: record.Header.Height, output: 58}, 26 | "Timestamp": {input: record.Header.Timestamp, output: int64(1598646467)}, 27 | "Term": {input: record.Header.Env.Term, output: "alacritty"}, 28 | "Shell": {input: record.Header.Env.Shell, output: "/usr/bin/zsh"}, 29 | "Event Time": {input: record.Events[0].Time, output: 2.677085}, 30 | "Event Type": {input: record.Events[0].EventType, output: asciicast.Output}, 31 | "Event Data": {input: record.Events[0].EventData, output: "h"}, 32 | } 33 | for name, tc := range tests { 34 | t.Run(name, func(t *testing.T) { 35 | testutils.Diff(t, tc.output, tc.input) 36 | }) 37 | } 38 | } 39 | 40 | func TestWriteRecords(t *testing.T) { 41 | record := setup(t) 42 | 43 | got, err := record.Marshal() 44 | if err != nil { 45 | t.Fatal(err) 46 | } 47 | 48 | want := goldie.New(t) 49 | want.AssertWithTemplate(t, "TestMarshal", record, got) 50 | } 51 | 52 | func TestToRelativeTime(t *testing.T) { 53 | cast := setup(t) 54 | 55 | cast.ToRelativeTime() 56 | 57 | for _, event := range cast.Events { 58 | t.Run(event.EventData, func(t *testing.T) { 59 | testutils.Diff(t, event.Time, float64(1)) 60 | }) 61 | } 62 | } 63 | 64 | func TestCompress(t *testing.T) { 65 | cast := setup(t) 66 | cast.Events[1].Time = 1 67 | 68 | cast.Compress() 69 | 70 | testutils.Diff(t, len(cast.Events), 2) 71 | testutils.Diff(t, cast.Events[0].EventData, "FirstSecond") 72 | testutils.Diff(t, cast.Events[1].EventData, "Third") 73 | } 74 | 75 | func TestToAbsoluteTime(t *testing.T) { 76 | cast := setup(t) 77 | 78 | cast.ToAbsoluteTime() 79 | 80 | testutils.Diff(t, cast.Events[0].Time, float64(1)) 81 | testutils.Diff(t, cast.Events[1].Time, float64(3)) 82 | testutils.Diff(t, cast.Events[2].Time, float64(6)) 83 | } 84 | 85 | func TestCapRelativeTime(t *testing.T) { 86 | cast := setup(t) 87 | 88 | cast.CapRelativeTime(0.5) 89 | 90 | for _, event := range cast.Events { 91 | t.Run(event.EventData, func(t *testing.T) { 92 | testutils.Diff(t, event.Time, 0.5) 93 | }) 94 | } 95 | } 96 | 97 | func TestAdjustSpeed(t *testing.T) { 98 | cast := setup(t) 99 | 100 | cast.AdjustSpeed(2.0) 101 | 102 | testutils.Diff(t, cast.Events[0].Time, float64(0.5)) 103 | testutils.Diff(t, cast.Events[1].Time, float64(1)) 104 | testutils.Diff(t, cast.Events[2].Time, float64(1.5)) 105 | } 106 | 107 | func setup(t *testing.T) *asciicast.Cast { 108 | t.Helper() 109 | 110 | t.Setenv("TERM", "TEST_TERM") 111 | t.Setenv("SHELL", "TEST_SHELL") 112 | 113 | cast := asciicast.New() 114 | cast.Header.Timestamp = 1337 115 | 116 | cast.Events = append(cast.Events, 117 | asciicast.Event{Time: 1, EventType: asciicast.Output, EventData: "First"}, 118 | asciicast.Event{Time: 2, EventType: asciicast.Output, EventData: "Second"}, 119 | asciicast.Event{Time: 3, EventType: asciicast.Input, EventData: "Third"}, 120 | ) 121 | 122 | return cast 123 | } 124 | -------------------------------------------------------------------------------- /examples/rgb.cast: -------------------------------------------------------------------------------- 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"] -------------------------------------------------------------------------------- /pkg/asciicast/asciicast.go: -------------------------------------------------------------------------------- 1 | // Package asciicast provides methods for working 2 | // with asciinema's file format asciicast v2. 3 | // 4 | // Refer to the official documentation about asciicast v2 format here: 5 | // https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md 6 | package asciicast 7 | 8 | import ( 9 | "encoding/json" 10 | "math" 11 | "os" 12 | "strings" 13 | "time" 14 | ) 15 | 16 | // header is JSON-encoded object containing recording meta-data. 17 | // fields with 'omitempty' are optional by asciicast v2 format 18 | type header struct { 19 | Version int `json:"version"` 20 | Width int `json:"width"` 21 | Height int `json:"height"` 22 | Timestamp int64 `json:"timestamp,omitempty"` 23 | Duration float64 `json:"duration,omitempty"` 24 | IdleTimeLimit float64 `json:"idle_time_limit,omitempty"` 25 | Command string `json:"command,omitempty"` 26 | Title string `json:"string,omitempty"` 27 | Env struct { 28 | Shell string `json:"SHELL,omitempty"` 29 | Term string `json:"TERM,omitempty"` 30 | } `json:"env,omitempty"` 31 | } 32 | 33 | // Cast contains asciicast file data 34 | type Cast struct { 35 | Header header 36 | Events []Event 37 | } 38 | 39 | // New will instantiate new Cast with basic medatada (version, timestamp and environment). 40 | func New() *Cast { 41 | const version = 2 42 | 43 | cast := &Cast{ 44 | Header: header{ 45 | Version: version, 46 | Timestamp: time.Now().Unix(), 47 | }, 48 | Events: []Event{}, 49 | } 50 | 51 | cast.Header.CaptureEnv() 52 | 53 | return cast 54 | } 55 | 56 | // CaptureEnv stores the environment variables 'shell' and 'term'. 57 | func (h *header) CaptureEnv() { 58 | h.Env.Shell = os.Getenv("SHELL") 59 | h.Env.Term = os.Getenv("TERM") 60 | } 61 | 62 | // Marshal returns the JSON-like encoding of v. 63 | func (c *Cast) Marshal() ([]byte, error) { 64 | header, err := json.Marshal(&c.Header) 65 | if err != nil { 66 | return nil, err 67 | } 68 | 69 | for i := range c.Events { 70 | header = append(header, '\n') 71 | 72 | js, err := json.Marshal(&c.Events[i]) 73 | if err != nil { 74 | return nil, err 75 | } 76 | 77 | header = append(header, js...) 78 | } 79 | 80 | return header, nil 81 | } 82 | 83 | // Unmarshal parses the JSON-encoded data into a Cast struct. 84 | func Unmarshal(data []byte) (*Cast, error) { 85 | var cast Cast 86 | 87 | err := cast.fromJSON(string(data)) 88 | if err != nil { 89 | return nil, err 90 | } 91 | 92 | // Duration field isn't required as v2 documentation but is needed for exporting purposes. 93 | if cast.Header.Duration == 0 { 94 | cast.Header.Duration = cast.Events[len(cast.Events)-1].Time 95 | } 96 | 97 | return &cast, nil 98 | } 99 | 100 | // ToRelativeTime converts event time to the difference between each event. 101 | func (c *Cast) ToRelativeTime() { 102 | prev := 0. 103 | 104 | for i, frame := range c.Events { 105 | delay := frame.Time - prev 106 | prev = frame.Time 107 | c.Events[i].Time = delay 108 | } 109 | } 110 | 111 | // CapRelativeTime limits the amount of time between each event 112 | func (c *Cast) CapRelativeTime(limit float64) { 113 | if limit > 0 { 114 | for i, frame := range c.Events { 115 | c.Events[i].Time = math.Min(frame.Time, limit) 116 | } 117 | } 118 | } 119 | 120 | // ToAbsoluteTime converts event time to the absolute difference from the start. 121 | // This is the default time format. 122 | func (c *Cast) ToAbsoluteTime() { 123 | time := 0. 124 | 125 | for i, frame := range c.Events { 126 | time += frame.Time 127 | c.Events[i].Time = time 128 | } 129 | } 130 | 131 | // AdjustSpeed changes the time of each event. 132 | // Slower < 1.0 > Faster. 133 | func (c *Cast) AdjustSpeed(speed float64) { 134 | for i := range c.Events { 135 | c.Events[i].Time /= speed 136 | } 137 | } 138 | 139 | // Compress chains together events with the same time. 140 | func (c *Cast) Compress() { 141 | var events []Event 142 | 143 | for i, event := range c.Events { 144 | if i == 0 { 145 | events = append(events, event) 146 | continue 147 | } 148 | 149 | if event.Time == events[len(events)-1].Time { 150 | events[len(events)-1].EventData += event.EventData 151 | } else { 152 | events = append(events, event) 153 | } 154 | 155 | } 156 | 157 | c.Events = events 158 | } 159 | 160 | // Asciicast format is not valid JSON so json.Unmarshal returns an error. 161 | // This function parses the file line by line to circumvent that. 162 | func (c *Cast) fromJSON(data string) error { 163 | lines := strings.Split(data, "\n") 164 | if lines[0][0] == '{' { 165 | err := json.Unmarshal([]byte(lines[0]), &c.Header) 166 | if err != nil { 167 | return err 168 | } 169 | 170 | lines = lines[1:] 171 | } 172 | 173 | for _, line := range lines { 174 | if line == "" { 175 | continue 176 | } 177 | var event Event 178 | 179 | err := json.Unmarshal([]byte(line), &event) 180 | if err != nil { 181 | return err 182 | } 183 | 184 | c.Events = append(c.Events, event) 185 | } 186 | 187 | return nil 188 | } 189 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | ### Record, share and export your terminal as a animated SVG image. 5 | 6 |
7 | 8 |
9 |
10 | 11 | [![golangci-lint](https://github.com/MrMarble/termsvg/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/MrMarble/termsvg/actions/workflows/golangci-lint.yml) 12 | [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) 13 | ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/mrmarble/termsvg) 14 | [![Go Reference](https://pkg.go.dev/badge/github.com/mrmarble/termsvg.svg)](https://pkg.go.dev/github.com/mrmarble/termsvg) 15 | 16 |
17 | 18 | --- 19 | 20 | ## Overview 21 | 22 | TermSVG is an all in one cli tool to record, replay and export your terminal session to svg. It uses the same format as [asciinema](https://asciinema.org) so you can convert asciicast files to SVG or use the asciinema player with a TermSVG recording. 23 | 24 | ## Installation 25 | 26 | ### Manually 27 | 28 | You can download a pre compiled binary directly from the [releases](https://github.com/mrmarble/termsvg/releases) for your OS/Architecture. 29 | 30 | ### Go cli 31 | 32 | If you already have Go in your system you can use `go install` 33 | 34 | ```sh 35 | go install github.com/mrmarble/termsvg/cmd/termsvg@latest # or target a specific version @v0.6.0 36 | ``` 37 | 38 | ### Install script 39 | 40 | I made an [installation script](scripts/install-termsvg.sh) that should download the latest available version corresponding to your OS and architecture. `sudo` is needed to copy the binary to `/usr/local/bin` 41 | 42 | ```sh 43 | curl -sL https://raw.githubusercontent.com/MrMarble/termsvg/master/scripts/install-termsvg.sh | sudo -E bash - 44 | # or with wget 45 | wget -O - https://raw.githubusercontent.com/MrMarble/termsvg/master/scripts/install-termsvg.sh | sudo -E bash - 46 | ``` 47 | 48 | > [!NOTE] 49 | > Windows binary does not have the `rec` command. 50 | 51 | --- 52 | 53 | ## Usage 54 | 55 | termsvg is composed of multiple commands, similar to `git`, `docker` or 56 | `asciinema`. 57 | 58 | When you run `termsvg` with no arguments help message is displayed, listing 59 | all available commands with their options. 60 | 61 | ### `rec ` 62 | 63 | **Record terminal session.** 64 | 65 | By running `termsvg rec ` you start a new recording session. The 66 | command (process) that is recorded can be specified with `-c` option (see 67 | below), and defaults to `$SHELL` which is what you want in most cases. 68 | 69 | You can temporarily pause recording of terminal by pressing Ctrl+P. 70 | This is useful when you want to execute some commands during the recording 71 | session that should not be captured (e.g. pasting secrets). Resume by pressing 72 | Ctrl+P again. 73 | 74 | Recording finishes when you exit the shell (hit Ctrl+D or type 75 | `exit`). If the recorded process is not a shell then recording finishes when 76 | the process exits. 77 | 78 | The resulting recording (called [asciicast](doc/asciicast-v2.md)) is saved to a local file. It can later be 79 | replayed with `termsvg play ` and/or exported to svg with `termsvg export -i `. 80 | 81 | Available options: 82 | 83 | - `-c, --command=` - Specify command to record, defaults to $SHELL 84 | 85 | ### `play ` 86 | 87 | **Replay recorded asciicast in a terminal.** 88 | 89 | This command replays given asciicast (as recorded by `rec` command) directly in 90 | your terminal. 91 | 92 | Playing from a local file: 93 | 94 | ```sh 95 | termsvg play /path/to/asciicast.cast 96 | ``` 97 | 98 | Available options: 99 | 100 | - `-i, --idle-time-limit=` - Limit replayed terminal inactivity to max `` seconds 101 | - `-s, --speed=` - Playback speed (can be fractional) 102 | 103 | > For the best playback experience it is recommended to run `termsvg play` in 104 | > a terminal of dimensions not smaller than the one used for recording, as 105 | > there's no "transcoding" of control sequences for new terminal size. 106 | 107 | ### `export ` 108 | 109 | **Export recorded asciicast to svg.** 110 | 111 | This command exports given asciicast (as recorded by `rec` command) to svg. 112 | 113 | Exporting from a local file: 114 | 115 | ```sh 116 | termsvg export /path/to/asciicast.cast 117 | ``` 118 | 119 | Available options: 120 | 121 | - `-o, --output=` - Output svg to be created. Defaults to [input].svg 122 | - `-m, --minify` - Minify svg using [Minify](https://github.com/tdewolff/minify) 123 | 124 | ## Example 125 | 126 | Asciinema recording [inverted pendulum](https://asciinema.org/a/444816) 127 | ![inverted pendulum](examples/444816.svg) 128 | 129 | More at the [examples](examples) folder 130 | 131 | ## Contributing 132 | 133 | If you want to contribute to this project check out [CONTRIBUTING.md](CONTRIBUTING.md). 134 | 135 | ## License 136 | 137 | All code is licensed under the GPL, v3 or later. See [LICENSE](LICENSE) file for details. 138 | 139 | ## ⭐ Stargazers 140 | 141 | 142 | 143 | 144 | 145 | Star History Chart 146 | 147 | 148 | -------------------------------------------------------------------------------- /pkg/color/colors.go: -------------------------------------------------------------------------------- 1 | // Code generated by go generate; DO NOT EDIT. 2 | // This file was generated by robots at 3 | // 2022-03-12 13:34:58.775992569 +0100 CET m=+0.003176029 4 | package color 5 | 6 | var colors = []string{ 7 | // ANSI colors 8 | 0: "#000000", 9 | 1: "#cd0000", 10 | 2: "#00cd00", 11 | 3: "#cdcd00", 12 | 4: "#0000ee", 13 | 5: "#cd00cd", 14 | 6: "#00cdcd", 15 | 7: "#e5e5e5", 16 | 8: "#7f7f7f", 17 | 9: "#ff0000", 18 | 10: "#00ff00", 19 | 11: "#ffff00", 20 | 12: "#5c5cff", 21 | 13: "#ff00ff", 22 | 14: "#00ffff", 23 | 15: "#ffffff", 24 | 25 | // XTERM colors 26 | 16: "#000000", 27 | 17: "#00005f", 28 | 18: "#000087", 29 | 19: "#0000af", 30 | 20: "#0000d7", 31 | 21: "#0000ff", 32 | 22: "#005f00", 33 | 23: "#005f5f", 34 | 24: "#005f87", 35 | 25: "#005faf", 36 | 26: "#005fd7", 37 | 27: "#005fff", 38 | 28: "#008700", 39 | 29: "#00875f", 40 | 30: "#008787", 41 | 31: "#0087af", 42 | 32: "#0087d7", 43 | 33: "#0087ff", 44 | 34: "#00af00", 45 | 35: "#00af5f", 46 | 36: "#00af87", 47 | 37: "#00afaf", 48 | 38: "#00afd7", 49 | 39: "#00afff", 50 | 40: "#00d700", 51 | 41: "#00d75f", 52 | 42: "#00d787", 53 | 43: "#00d7af", 54 | 44: "#00d7d7", 55 | 45: "#00d7ff", 56 | 46: "#00ff00", 57 | 47: "#00ff5f", 58 | 48: "#00ff87", 59 | 49: "#00ffaf", 60 | 50: "#00ffd7", 61 | 51: "#00ffff", 62 | 52: "#5f0000", 63 | 53: "#5f005f", 64 | 54: "#5f0087", 65 | 55: "#5f00af", 66 | 56: "#5f00d7", 67 | 57: "#5f00ff", 68 | 58: "#5f5f00", 69 | 59: "#5f5f5f", 70 | 60: "#5f5f87", 71 | 61: "#5f5faf", 72 | 62: "#5f5fd7", 73 | 63: "#5f5fff", 74 | 64: "#5f8700", 75 | 65: "#5f875f", 76 | 66: "#5f8787", 77 | 67: "#5f87af", 78 | 68: "#5f87d7", 79 | 69: "#5f87ff", 80 | 70: "#5faf00", 81 | 71: "#5faf5f", 82 | 72: "#5faf87", 83 | 73: "#5fafaf", 84 | 74: "#5fafd7", 85 | 75: "#5fafff", 86 | 76: "#5fd700", 87 | 77: "#5fd75f", 88 | 78: "#5fd787", 89 | 79: "#5fd7af", 90 | 80: "#5fd7d7", 91 | 81: "#5fd7ff", 92 | 82: "#5fff00", 93 | 83: "#5fff5f", 94 | 84: "#5fff87", 95 | 85: "#5fffaf", 96 | 86: "#5fffd7", 97 | 87: "#5fffff", 98 | 88: "#870000", 99 | 89: "#87005f", 100 | 90: "#870087", 101 | 91: "#8700af", 102 | 92: "#8700d7", 103 | 93: "#8700ff", 104 | 94: "#875f00", 105 | 95: "#875f5f", 106 | 96: "#875f87", 107 | 97: "#875faf", 108 | 98: "#875fd7", 109 | 99: "#875fff", 110 | 100: "#878700", 111 | 101: "#87875f", 112 | 102: "#878787", 113 | 103: "#8787af", 114 | 104: "#8787d7", 115 | 105: "#8787ff", 116 | 106: "#87af00", 117 | 107: "#87af5f", 118 | 108: "#87af87", 119 | 109: "#87afaf", 120 | 110: "#87afd7", 121 | 111: "#87afff", 122 | 112: "#87d700", 123 | 113: "#87d75f", 124 | 114: "#87d787", 125 | 115: "#87d7af", 126 | 116: "#87d7d7", 127 | 117: "#87d7ff", 128 | 118: "#87ff00", 129 | 119: "#87ff5f", 130 | 120: "#87ff87", 131 | 121: "#87ffaf", 132 | 122: "#87ffd7", 133 | 123: "#87ffff", 134 | 124: "#af0000", 135 | 125: "#af005f", 136 | 126: "#af0087", 137 | 127: "#af00af", 138 | 128: "#af00d7", 139 | 129: "#af00ff", 140 | 130: "#af5f00", 141 | 131: "#af5f5f", 142 | 132: "#af5f87", 143 | 133: "#af5faf", 144 | 134: "#af5fd7", 145 | 135: "#af5fff", 146 | 136: "#af8700", 147 | 137: "#af875f", 148 | 138: "#af8787", 149 | 139: "#af87af", 150 | 140: "#af87d7", 151 | 141: "#af87ff", 152 | 142: "#afaf00", 153 | 143: "#afaf5f", 154 | 144: "#afaf87", 155 | 145: "#afafaf", 156 | 146: "#afafd7", 157 | 147: "#afafff", 158 | 148: "#afd700", 159 | 149: "#afd75f", 160 | 150: "#afd787", 161 | 151: "#afd7af", 162 | 152: "#afd7d7", 163 | 153: "#afd7ff", 164 | 154: "#afff00", 165 | 155: "#afff5f", 166 | 156: "#afff87", 167 | 157: "#afffaf", 168 | 158: "#afffd7", 169 | 159: "#afffff", 170 | 160: "#d70000", 171 | 161: "#d7005f", 172 | 162: "#d70087", 173 | 163: "#d700af", 174 | 164: "#d700d7", 175 | 165: "#d700ff", 176 | 166: "#d75f00", 177 | 167: "#d75f5f", 178 | 168: "#d75f87", 179 | 169: "#d75faf", 180 | 170: "#d75fd7", 181 | 171: "#d75fff", 182 | 172: "#d78700", 183 | 173: "#d7875f", 184 | 174: "#d78787", 185 | 175: "#d787af", 186 | 176: "#d787d7", 187 | 177: "#d787ff", 188 | 178: "#d7af00", 189 | 179: "#d7af5f", 190 | 180: "#d7af87", 191 | 181: "#d7afaf", 192 | 182: "#d7afd7", 193 | 183: "#d7afff", 194 | 184: "#d7d700", 195 | 185: "#d7d75f", 196 | 186: "#d7d787", 197 | 187: "#d7d7af", 198 | 188: "#d7d7d7", 199 | 189: "#d7d7ff", 200 | 190: "#d7ff00", 201 | 191: "#d7ff5f", 202 | 192: "#d7ff87", 203 | 193: "#d7ffaf", 204 | 194: "#d7ffd7", 205 | 195: "#d7ffff", 206 | 196: "#ff0000", 207 | 197: "#ff005f", 208 | 198: "#ff0087", 209 | 199: "#ff00af", 210 | 200: "#ff00d7", 211 | 201: "#ff00ff", 212 | 202: "#ff5f00", 213 | 203: "#ff5f5f", 214 | 204: "#ff5f87", 215 | 205: "#ff5faf", 216 | 206: "#ff5fd7", 217 | 207: "#ff5fff", 218 | 208: "#ff8700", 219 | 209: "#ff875f", 220 | 210: "#ff8787", 221 | 211: "#ff87af", 222 | 212: "#ff87d7", 223 | 213: "#ff87ff", 224 | 214: "#ffaf00", 225 | 215: "#ffaf5f", 226 | 216: "#ffaf87", 227 | 217: "#ffafaf", 228 | 218: "#ffafd7", 229 | 219: "#ffafff", 230 | 220: "#ffd700", 231 | 221: "#ffd75f", 232 | 222: "#ffd787", 233 | 223: "#ffd7af", 234 | 224: "#ffd7d7", 235 | 225: "#ffd7ff", 236 | 226: "#ffff00", 237 | 227: "#ffff5f", 238 | 228: "#ffff87", 239 | 229: "#ffffaf", 240 | 230: "#ffffd7", 241 | 231: "#ffffff", 242 | 232: "#080808", 243 | 233: "#121212", 244 | 234: "#1c1c1c", 245 | 235: "#262626", 246 | 236: "#303030", 247 | 237: "#3a3a3a", 248 | 238: "#444444", 249 | 239: "#4e4e4e", 250 | 240: "#585858", 251 | 241: "#626262", 252 | 242: "#6c6c6c", 253 | 243: "#767676", 254 | 244: "#808080", 255 | 245: "#8a8a8a", 256 | 246: "#949494", 257 | 247: "#9e9e9e", 258 | 248: "#a8a8a8", 259 | 249: "#b2b2b2", 260 | 250: "#bcbcbc", 261 | 251: "#c6c6c6", 262 | 252: "#d0d0d0", 263 | 253: "#dadada", 264 | 254: "#e4e4e4", 265 | 255: "#eeeeee", 266 | } 267 | -------------------------------------------------------------------------------- /cmd/termsvg/rec/rec.go: -------------------------------------------------------------------------------- 1 | package rec 2 | 3 | import ( 4 | "io" 5 | "os" 6 | "os/exec" 7 | "os/signal" 8 | "strings" 9 | "sync/atomic" 10 | "syscall" 11 | "time" 12 | 13 | "github.com/creack/pty" 14 | "github.com/mrmarble/termsvg/pkg/asciicast" 15 | "github.com/rs/zerolog/log" 16 | "golang.org/x/term" 17 | ) 18 | 19 | type Cmd struct { 20 | File string `arg:"" type:"path" help:"filename/path to save the recording to"` 21 | Command string `short:"c" optional:"" env:"SHELL" help:"Specify command to record, defaults to $SHELL"` 22 | SkipFirstLine bool `short:"s" help:"Skip the first line of recording"` 23 | } 24 | 25 | const readSize = 1024 26 | 27 | func (cmd *Cmd) Run() error { 28 | log.Info().Str("output", cmd.File).Msg("recording asciicast.") 29 | log.Info().Msg("exit the opened program when you're done.") 30 | 31 | if cmd.SkipFirstLine { 32 | log.Warn().Msg("Skipping the first line of recording.") 33 | } 34 | 35 | err := rec(cmd.File, cmd.Command, cmd.SkipFirstLine) 36 | if err != nil { 37 | return err 38 | } 39 | 40 | log.Info().Msg("recording finished.") 41 | log.Info().Str("output", cmd.File).Msg("asciicast saved.") 42 | 43 | return nil 44 | } 45 | 46 | func rec(file, command string, skipFirstLine bool) error { 47 | events, err := run(command, skipFirstLine) 48 | if err != nil { 49 | return err 50 | } 51 | 52 | rec := asciicast.New() 53 | 54 | width, height, err := term.GetSize(int(os.Stdout.Fd())) 55 | if err != nil { 56 | return err 57 | } 58 | 59 | rec.Header.Width = width 60 | rec.Header.Height = height 61 | rec.Header.Duration = events[len(events)-1].Time 62 | rec.Events = events 63 | rec.Compress() 64 | 65 | js, err := rec.Marshal() 66 | if err != nil { 67 | return err 68 | } 69 | 70 | err = os.WriteFile(file, js, 0o600) 71 | if err != nil { 72 | return err 73 | } 74 | 75 | return nil 76 | } 77 | 78 | // nolint 79 | func run(command string, skipFirstLine bool) ([]asciicast.Event, error) { 80 | // Create arbitrary command. 81 | c := exec.Command("sh", "-c", command) 82 | // Start the command with a pty. 83 | ptmx, err := pty.Start(c) 84 | if err != nil { 85 | return nil, err 86 | } 87 | // Make sure to close the pty at the end. 88 | defer func() { 89 | if err = ptmx.Close(); err != nil { 90 | log.Fatal().Err(err).Msg("error closing pty") 91 | } 92 | }() // Best effort. 93 | 94 | ch := handlePtySize(ptmx) 95 | defer func() { signal.Stop(ch); close(ch) }() // Cleanup signals when done. 96 | 97 | // Set stdin in raw mode. 98 | oldState, err := term.MakeRaw(int(os.Stdin.Fd())) 99 | if err != nil { 100 | log.Fatal().Err(err).Msg("error setting stin in raw mode") 101 | } 102 | 103 | defer func() { 104 | if err = term.Restore(int(os.Stdin.Fd()), oldState); err != nil { 105 | log.Fatal().Err(err).Msg("error restoring terminal") 106 | } 107 | }() // Best effort. 108 | 109 | // Copy stdin to the pty and the pty to stdout. 110 | // NOTE: The goroutine will keep reading until the next keystroke before returning. 111 | var paused atomic.Bool 112 | go func() { 113 | buf := make([]byte, readSize) 114 | for { 115 | n, err := os.Stdin.Read(buf) 116 | if err != nil { 117 | if err != io.EOF { 118 | log.Fatal().Err(err).Msg("error reading stdin") 119 | } 120 | return 121 | } 122 | 123 | // Check for Ctrl+P (0x10) 124 | for i := 0; i < n; i++ { 125 | if buf[i] == 0x10 { // Ctrl+P 126 | if paused.Load() { 127 | paused.Store(false) 128 | } else { 129 | paused.Store(true) 130 | } 131 | continue 132 | } 133 | // Write byte to pty 134 | if _, err := ptmx.Write(buf[i:i+1]); err != nil { 135 | log.Fatal().Err(err).Msg("error writing to pty") 136 | } 137 | } 138 | } 139 | }() 140 | 141 | var events []asciicast.Event 142 | 143 | p := make([]byte, readSize) 144 | baseTime := time.Now().UnixMicro() 145 | 146 | startTriggered := false 147 | 148 | pauseStartTime := int64(0) 149 | totalPausedTime := int64(0) 150 | 151 | for { 152 | n, err := ptmx.Read(p) 153 | 154 | if err != nil { 155 | if err == io.EOF { 156 | os.Stdout.Write(p[:n]) // should handle any remainding bytes. 157 | 158 | // Only record if not paused 159 | if !paused.Load() { 160 | event := asciicast.Event{ 161 | Time: float64(time.Now().UnixMicro()-baseTime-totalPausedTime) / float64(time.Millisecond), 162 | EventType: asciicast.Output, EventData: string(p[:n]), 163 | } 164 | events = append(events, event) 165 | } 166 | } 167 | 168 | break 169 | } 170 | 171 | os.Stdout.Write(p[:n]) 172 | 173 | // Handle pause state 174 | isPaused := paused.Load() 175 | if isPaused { 176 | if pauseStartTime == 0 { 177 | pauseStartTime = time.Now().UnixMicro() 178 | } 179 | continue 180 | } else { 181 | if pauseStartTime != 0 { 182 | totalPausedTime += time.Now().UnixMicro() - pauseStartTime 183 | pauseStartTime = 0 184 | } 185 | } 186 | 187 | // Skip the first line 188 | if skipFirstLine { 189 | if !startTriggered { 190 | if strings.Contains(string(p[:n]), "\n") { 191 | startTriggered = true 192 | baseTime = time.Now().UnixMicro() 193 | continue 194 | } else { 195 | continue 196 | } 197 | } 198 | } 199 | 200 | event := asciicast.Event{ 201 | Time: float64(time.Now().UnixMicro()-baseTime-totalPausedTime) / float64(time.Millisecond), 202 | EventType: asciicast.Output, EventData: string(p[:n]), 203 | } 204 | events = append(events, event) 205 | } 206 | 207 | return events, nil 208 | } 209 | 210 | func handlePtySize(ptmx *os.File) chan os.Signal { 211 | // Handle pty size. 212 | ch := make(chan os.Signal, 1) 213 | signal.Notify(ch, syscall.SIGWINCH) 214 | 215 | go func() { 216 | for range ch { 217 | if err := pty.InheritSize(os.Stdin, ptmx); err != nil { 218 | log.Fatal().Err(err).Msg("error resizing pty") 219 | } 220 | } 221 | }() 222 | ch <- syscall.SIGWINCH // Initial resize. 223 | 224 | return ch 225 | } 226 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 | github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= 3 | github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= 4 | github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= 5 | github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= 6 | github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= 7 | github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= 8 | github.com/alecthomas/kong v1.12.0 h1:oKd/0fHSdajj5PfGDd3ScvEvpVJf9mT2mb5r9xYadYM= 9 | github.com/alecthomas/kong v1.12.0/go.mod h1:p2vqieVMeTAnaC83txKtXe8FLke2X07aruPWXyMPQrU= 10 | github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= 11 | github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= 12 | github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= 13 | github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s= 14 | github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE= 15 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 16 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 17 | github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= 18 | github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= 19 | github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= 20 | github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= 21 | github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= 22 | github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02 h1:AgcIVYPa6XJnU3phs104wLj8l5GEththEw6+F79YsIY= 23 | github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68= 24 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= 25 | github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= 26 | github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= 27 | github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= 28 | github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= 29 | github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 30 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 31 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 32 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 33 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 34 | github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= 35 | github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= 36 | github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= 37 | github.com/sebdah/goldie/v2 v2.7.1 h1:PkBHymaYdtvEkZV7TmyqKxdmn5/Vcj+8TpATWZjnG5E= 38 | github.com/sebdah/goldie/v2 v2.7.1/go.mod h1:oZ9fp0+se1eapSRjfYbsV/0Hqhbuu3bJVvKI/NNtssI= 39 | github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= 40 | github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= 41 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 42 | github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= 43 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 44 | github.com/tdewolff/minify/v2 v2.23.8 h1:tvjHzRer46kwOfpdCBCWsDblCw3QtnLJRd61pTVkyZ8= 45 | github.com/tdewolff/minify/v2 v2.23.8/go.mod h1:VW3ISUd3gDOZuQ/jwZr4sCzsuX+Qvsx87FDMjk6Rvno= 46 | github.com/tdewolff/parse/v2 v2.8.1 h1:J5GSHru6o3jF1uLlEKVXkDxxcVx6yzOlIVIotK4w2po= 47 | github.com/tdewolff/parse/v2 v2.8.1/go.mod h1:Hwlni2tiVNKyzR1o6nUs4FOF07URA+JLBLd6dlIXYqo= 48 | github.com/tdewolff/test v1.0.11 h1:FdLbwQVHxqG16SlkGveC0JVyrJN62COWTRyUFzfbtBE= 49 | github.com/tdewolff/test v1.0.11/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8= 50 | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= 51 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 52 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 53 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 54 | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 55 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 56 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 57 | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 58 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 59 | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 60 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 61 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 62 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 63 | golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 64 | golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 65 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 66 | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 67 | golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= 68 | golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 69 | golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= 70 | golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= 71 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 72 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 73 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 74 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 75 | golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= 76 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 77 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 78 | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 79 | honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= 80 | -------------------------------------------------------------------------------- /internal/svg/svg.go: -------------------------------------------------------------------------------- 1 | package svg 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "strings" 7 | 8 | svg "github.com/ajstarks/svgo" 9 | "github.com/hinshun/vt10x" 10 | "github.com/mrmarble/termsvg/internal/uniqueid" 11 | "github.com/mrmarble/termsvg/pkg/asciicast" 12 | "github.com/mrmarble/termsvg/pkg/color" 13 | "github.com/mrmarble/termsvg/pkg/css" 14 | ) 15 | 16 | type Canvas struct { 17 | *svg.SVG 18 | asciicast.Cast 19 | id *uniqueid.ID 20 | width int 21 | height int 22 | colors map[string]string 23 | } 24 | 25 | type Output interface { 26 | io.Writer 27 | } 28 | 29 | const ( 30 | rowHeight = 25 31 | colWidth = 12 32 | padding = 20 33 | headerSize = 3 34 | ) 35 | 36 | // If user passed custom background and text colors, use them 37 | var ( 38 | foregroundColorOverride = "" 39 | backgroundColorOverride = "" 40 | ) 41 | 42 | func Export(input asciicast.Cast, output Output, bgColor, textColor string, noWindow bool) { 43 | // Set the custom foreground and background colors 44 | foregroundColorOverride = textColor 45 | backgroundColorOverride = bgColor 46 | 47 | input.Compress() // to reduce the number of frames 48 | 49 | createCanvas(svg.New(output), input, noWindow) 50 | } 51 | 52 | func createCanvas(svg *svg.SVG, cast asciicast.Cast, noWindow bool) { 53 | canvas := &Canvas{SVG: svg, Cast: cast, id: uniqueid.New(), colors: make(map[string]string)} 54 | canvas.width = cast.Header.Width * colWidth 55 | canvas.height = cast.Header.Height * rowHeight 56 | 57 | parseCast(canvas) 58 | canvas.Start(canvas.paddedWidth(), canvas.paddedHeight()) 59 | if !noWindow { 60 | canvas.createWindow() 61 | canvas.Group(fmt.Sprintf(`transform="translate(%d,%d)"`, padding, padding*headerSize)) 62 | } else { 63 | if backgroundColorOverride == "" { 64 | canvas.Rect(0, 0, canvas.paddedWidth(), canvas.paddedHeight(), "fill:#282d35") 65 | } else { 66 | canvas.Rect(0, 0, canvas.paddedWidth(), canvas.paddedHeight(), "fill:"+backgroundColorOverride) 67 | } 68 | canvas.Group(fmt.Sprintf(`transform="translate(%d,%d)"`, padding, int(padding*1.5))) 69 | } 70 | canvas.addStyles() 71 | canvas.createFrames() 72 | canvas.Gend() // Transform 73 | canvas.Gend() // Styles 74 | canvas.End() 75 | } 76 | 77 | func parseCast(c *Canvas) { 78 | term := vt10x.New(vt10x.WithSize(c.Header.Width, c.Header.Height)) 79 | 80 | for _, event := range c.Events { 81 | _, err := term.Write([]byte(event.EventData)) 82 | if err != nil { 83 | panic(err) 84 | } 85 | 86 | for row := 0; row < c.Header.Height; row++ { 87 | for col := 0; col < c.Header.Width; col++ { 88 | cell := term.Cell(col, row) 89 | 90 | c.getColors(cell) 91 | } 92 | } 93 | } 94 | } 95 | 96 | func (c *Canvas) getColors(cell vt10x.Glyph) { 97 | fg := color.GetColor(cell.FG) 98 | 99 | if _, ok := c.colors[fg]; !ok { 100 | c.colors[fg] = c.id.String() 101 | c.id.Next() 102 | } 103 | 104 | if cell.BG != vt10x.DefaultBG { 105 | bg := color.GetColor(cell.BG) 106 | if _, ok := c.colors[bg]; !ok { 107 | c.colors[bg] = c.id.String() 108 | c.id.Next() 109 | } 110 | } 111 | } 112 | 113 | func (c *Canvas) paddedWidth() int { 114 | return c.width + (padding << 1) 115 | } 116 | 117 | func (c *Canvas) paddedHeight() int { 118 | return c.height + (padding * headerSize) 119 | } 120 | 121 | func (c *Canvas) createWindow() { 122 | windowRadius := 5 123 | buttonRadius := 7 124 | buttonColors := [3]string{"#ff5f58", "#ffbd2e", "#18c132"} 125 | 126 | // If the user has specified a background color, use that instead of the default 127 | if backgroundColorOverride != "" { 128 | c.Roundrect(0, 0, c.paddedWidth(), c.paddedHeight(), windowRadius, windowRadius, "fill:"+backgroundColorOverride) 129 | } else { 130 | c.Roundrect(0, 0, c.paddedWidth(), c.paddedHeight(), windowRadius, windowRadius, "fill:#282d35") 131 | } 132 | 133 | for i := range buttonColors { 134 | c.Circle((i*(padding+buttonRadius/2))+padding, padding, buttonRadius, fmt.Sprintf("fill:%s", buttonColors[i])) 135 | } 136 | } 137 | 138 | func (c *Canvas) addStyles() { 139 | c.Gstyle(css.Rules{ 140 | "animation-duration": fmt.Sprintf("%.2fs", c.Header.Duration), 141 | "animation-iteration-count": "infinite", 142 | "animation-name": "k", 143 | "animation-timing-function": "steps(1,end)", 144 | "font-family": "Monago,Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace", 145 | "font-size": "20px", 146 | }.String()) 147 | 148 | // Foreground color gets set here 149 | colors := css.Blocks{} 150 | for color, class := range c.colors { 151 | colors = append(colors, css.Block{Selector: fmt.Sprintf(".%s", class), Rules: css.Rules{"fill": color}}) 152 | } 153 | 154 | styles := generateKeyframes(c.Cast, c.paddedWidth()) 155 | styles += css.Block{Selector: ".bold", Rules: css.Rules{"font-weight": "bold"}}.String() 156 | styles += css.Block{Selector: ".italic", Rules: css.Rules{"font-style": "italic"}}.String() 157 | styles += css.Block{Selector: ".underline", Rules: css.Rules{"text-decoration": "underline"}}.String() 158 | styles += css.Block{Selector: ".dim", Rules: css.Rules{"opacity": "0.5"}}.String() 159 | // If custom colors have been provided, use them instead 160 | if foregroundColorOverride != "" { 161 | styles += fmt.Sprintf(".a{fill:%s}", foregroundColorOverride) 162 | } else { 163 | styles += colors.String() 164 | } 165 | c.Style("text/css", styles) 166 | } 167 | 168 | func (c *Canvas) createFrames() { 169 | term := vt10x.New(vt10x.WithSize(c.Header.Width, c.Header.Height)) 170 | 171 | for i, event := range c.Events { 172 | _, err := term.Write([]byte(event.EventData)) 173 | if err != nil { 174 | panic(err) 175 | } 176 | 177 | c.Gtransform(fmt.Sprintf("translate(%d)", c.paddedWidth()*i)) 178 | c.renderRows(term) 179 | c.Gend() 180 | } 181 | } 182 | 183 | func (c *Canvas) renderRows(term vt10x.Terminal) { 184 | for row := 0; row < c.Header.Height; row++ { 185 | c.renderRow(term, row) 186 | } 187 | } 188 | 189 | func (c *Canvas) renderRow(term vt10x.Terminal, row int) { 190 | frame := "" 191 | lastColor := term.Cell(0, row).FG 192 | lastColummn := 0 193 | lastBold := isBold(term.Cell(0, row)) 194 | lastItalic := isItalic(term.Cell(0, row)) 195 | lastUnderline := isUnderline(term.Cell(0, row)) 196 | lastDim := isDim(term.Cell(0, row)) 197 | 198 | for col := 0; col < c.Header.Width; col++ { 199 | cell := term.Cell(col, row) 200 | c.addBG(cell.BG) 201 | 202 | if c.cellAttributesChanged(cell, lastColor, lastBold, lastItalic, lastUnderline, lastDim) { 203 | if frame != "" { 204 | class := c.buildClassString(lastColor, lastBold, lastItalic, lastUnderline, lastDim) 205 | c.Text(lastColummn*colWidth, row*rowHeight, frame, fmt.Sprintf(`class="%s"`, class), c.applyBG(cell.BG)) 206 | frame = "" 207 | } 208 | 209 | if cell.Char == ' ' { 210 | lastColummn = col + 1 211 | continue 212 | } 213 | lastColor = cell.FG 214 | lastColummn = col 215 | lastBold = isBold(cell) 216 | lastItalic = isItalic(cell) 217 | lastUnderline = isUnderline(cell) 218 | lastDim = isDim(cell) 219 | } 220 | 221 | frame += string(cell.Char) 222 | } 223 | 224 | if strings.TrimSpace(frame) != "" { 225 | c.Text(lastColummn*colWidth, row*rowHeight, frame, fmt.Sprintf(`class="%s"`, c.colors[color.GetColor(lastColor)])) 226 | } 227 | } 228 | 229 | func (c *Canvas) cellAttributesChanged( 230 | cell vt10x.Glyph, lastColor vt10x.Color, lastBold, lastItalic, lastUnderline, lastDim bool, 231 | ) bool { 232 | return cell.Char == ' ' || cell.FG != lastColor || 233 | isBold(cell) != lastBold || isItalic(cell) != lastItalic || 234 | isUnderline(cell) != lastUnderline || isDim(cell) != lastDim 235 | } 236 | 237 | func (c *Canvas) buildClassString(fgColor vt10x.Color, bold, italic, underline, dim bool) string { 238 | class := c.colors[color.GetColor(fgColor)] 239 | if bold { 240 | class += " bold" 241 | } 242 | if italic { 243 | class += " italic" 244 | } 245 | if underline { 246 | class += " underline" 247 | } 248 | if dim { 249 | class += " dim" 250 | } 251 | return class 252 | } 253 | 254 | func (c *Canvas) addBG(bg vt10x.Color) { 255 | if bg != vt10x.DefaultBG { 256 | if _, ok := c.colors[fmt.Sprint(bg)]; !ok { 257 | c.Def() 258 | c.Filter(fmt.Sprint(bg)) 259 | c.FeFlood(svg.Filterspec{Result: "bg"}, color.GetColor(bg), 1.0) 260 | c.FeMerge([]string{`bg`, `SourceGraphic`}) 261 | c.Fend() 262 | c.DefEnd() 263 | c.colors[fmt.Sprint(bg)] = "" 264 | } 265 | } 266 | } 267 | 268 | func (c *Canvas) applyBG(bg vt10x.Color) string { 269 | if bg != vt10x.DefaultBG { 270 | if _, ok := c.colors[fmt.Sprint(bg)]; ok { 271 | return fmt.Sprintf(`filter="url(#%s)"`, fmt.Sprint(bg)) 272 | } 273 | } 274 | 275 | return "" 276 | } 277 | 278 | func isBold(g vt10x.Glyph) bool { 279 | return g.Mode&4 != 0 280 | } 281 | 282 | func isItalic(g vt10x.Glyph) bool { 283 | return g.Mode&16 != 0 284 | } 285 | 286 | func isUnderline(g vt10x.Glyph) bool { 287 | return g.Mode&2 != 0 288 | } 289 | 290 | func isDim(g vt10x.Glyph) bool { 291 | return g.Mode&1 != 0 292 | } 293 | 294 | func generateKeyframes(cast asciicast.Cast, width int) string { 295 | css := "@keyframes k {" 296 | for i, frame := range cast.Events { 297 | css += generateKeyframe(float32(frame.Time*100/cast.Header.Duration), width*i) 298 | } 299 | 300 | css += "}" 301 | 302 | return css 303 | } 304 | 305 | func generateKeyframe(percent float32, translate int) string { 306 | return fmt.Sprintf("%.3f%%{transform:translateX(-%dpx)}", percent, translate) 307 | } 308 | -------------------------------------------------------------------------------- /examples/htop.cast: -------------------------------------------------------------------------------- 1 | {"version":2,"width":120,"height":30,"timestamp":1646522098,"duration":7.439,"env":{"SHELL":"/usr/bin/zsh","TERM":"xterm-256color"}} 2 | [0.499,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 3 | [0.524,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K\u001b[?1h\u001b="] 4 | [0.525,"o","\u001b[?2004h"] 5 | [1.486,"o","\u001b[1m\u001b[31mh\u001b[0m\u001b[39m\u0008\u001b[1m\u001b[31mh\u001b[0m\u001b[39m\u001b[90mtop\u001b[39m\u0008\u0008\u0008"] 6 | [1.629,"o","\u0008\u001b[1m\u001b[31mh\u001b[1m\u001b[31mt\u001b[0m\u001b[39m"] 7 | [1.74,"o","\u0008\u0008\u001b[1m\u001b[31mh\u001b[1m\u001b[31mt\u001b[1m\u001b[31mo\u001b[0m\u001b[39m"] 8 | [1.815,"o","\u0008\u0008\u0008\u001b[0m\u001b[32mh\u001b[0m\u001b[32mt\u001b[0m\u001b[32mo\u001b[32mp\u001b[39m"] 9 | [2.489,"o","\u001b[?1l\u001b\u003e"] 10 | [2.49,"o","\u001b[?2004l\r\r\n\u001b]2;htop\u0007\u001b]1;htop\u0007"] 11 | [2.501,"o","\u001b[?1049h\u001b[22;0;0t\u001b[1;30r\u001b(B\u001b[m\u001b[4l\u001b[?7h\u001b[?1h\u001b=\u001b[?25l\u001b[39;49m\u001b[?1000h"] 12 | [2.594,"o","\u001b[39;49m\u001b(B\u001b[m\u001b[H\u001b[2J\u001b[2d \u001b[36m1 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[2;24H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m7 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[2;53H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m13 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[2;82H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m19 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[2;111H0.0%\u001b[39m]\u001b[3;3H\u001b(B\u001b[0m\u001b[36m2 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[3;24H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m8 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[3;53H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m14 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[3;82H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m20 \u001b[39m\u001b(B\u001b[0;1m[\u001b(B\u001b[0m\u001b[31m|||||||||||||||100.0%\u001b[39m\u001b(B\u001b[0;1m]\u001b[4;3H\u001b(B\u001b[0m\u001b[36m3 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[4;24H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m9 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[4;53H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m15 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[4;82H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m21 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[4;111H0.0%\u001b[39m]\u001b[5;3H\u001b(B\u001b[0m\u001b[36m4 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[5;24H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m10 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[5;53H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m16 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[5;82H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m22 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[5;111H0.0%\u001b[39m]\u001b[6;3H\u001b(B\u001b[0m\u001b[36m5 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[6;24H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m11 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[6;53H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m17 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[6;82H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m23 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[6;111H0.0%\u001b[39m]\u001b[7;3H\u001b(B\u001b[0m\u001b[36m6 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[7;24H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m12 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[7;53H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m18 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[7;82H0.0%\u001b[39m]\u001b(B\u001b[m \u001b[36m24 \u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[17X\u001b[7;111H0.0%\u001b[39m]\u001b[8;3H\u001b(B\u001b[0m\u001b[36mMem\u001b[39m\u001b(B\u001b[0;1m[\u001b(B\u001b[0m\u001b[32m|||||||||||||\u001b[34m||||\u001b[33m||||||||||||||||\u001b(B\u001b[0;1m\u001b[90m 2.00G/7.72G\u001b[39m]\u001b(B\u001b[m \u001b[36mTasks: \u001b(B\u001b[0;1m\u001b[36m41\u001b(B\u001b[0m\u001b[36m, \u001b(B\u001b[0;1m\u001b[32m211\u001b(B\u001b[0m\u001b[32m thr\u001b[36m; \u001b(B\u001b[0;1m\u001b[32m1\u001b(B\u001b[0m\u001b[36m running\u001b[9;3HSwp\u001b[39m\u001b(B\u001b[0;1m[\u001b[90m\u001b[42X\u001b[9;49H0K/2.00G\u001b[39m]\u001b(B\u001b[m \u001b[36mLoad average: \u001b[39m\u001b(B\u001b[0;1m0.00 \u001b[36m0.08 \u001b(B\u001b[0m\u001b[36m0.17 \u001b[10;61HUptime: \u001b(B\u001b[0;1m\u001b[36m13:54:53\r\u001b[12d\u001b(B\u001b[0m\u001b[30m\u001b[42m PID USER PRI NI VIRT RES SHR S \u001b[30m\u001b[46mCPU% \u001b[30m\u001b[42mMEM% TIME+ Command\u001b[K\r\u001b[13d\u001b[30m\u001b[46m 4385 mrmarble 20 0 8284 3688 3028 R 342. 0.0 0:00.01 htop\u001b[K\u001b[14;5H\u001b[39;49m\u001b(B\u001b[m5 \u001b(B\u001b[0;1m\u001b[90mroot \u001b[39m\u001b(B\u001b[m 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m424 \u001b[36m 1\u001b[39m\u001b(B\u001b[m524 \u001b[36m 1\u001b[39m\u001b(B\u001b[m020 S 0.0 0.0 0:00.26 \u001b[32m/init\u001b[15;5H\u001b[39m\u001b(B\u001b[m6 \u001b(B\u001b[0;1m\u001b[90mroot \u001b[39m\u001b(B\u001b[m 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m424 \u001b[36m 1\u001b[39m\u001b(B\u001b[m524 \u001b[36m 1\u001b[39m\u001b(B\u001b[m020 S 0.0 0.0 0:00.00 \u001b[32m/init\u001b[16;5H\u001b[39m\u001b(B\u001b[m1 \u001b(B\u001b[0;1m\u001b[90mroot \u001b[39m\u001b(B\u001b[m 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m424 \u001b[36m 1\u001b[39m\u001b(B\u001b[m524 \u001b[36m 1\u001b[39m\u001b(B\u001b[m020 S 0.0 0.0 0:00.94 /init\u001b[17;4H11 \u001b(B\u001b[0;1m\u001b[90mroot \u001b[39m\u001b(B\u001b[m 20 0 \u001b[36m 1\u001b[39m\u001b(B\u001b[m752 72 0 S 0.0 0.0 0:00.00 /init\u001b[18;4H12 \u001b(B\u001b[0;1m\u001b[90mroot \u001b[39m\u001b(B\u001b[m 20 0 \u001b[36m 1\u001b[39m\u001b(B\u001b[m752 80 0 S 0.0 0.0 0:00.07 /init\u001b[19;4H13 mrmarble 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m612 600 532 S 0.0 0.0 0:00.00 sh -c \"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh\" b52\u001b[20;4H14 mrmarble 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m612 \u001b[36m 1\u001b[39m\u001b(B\u001b[m676 \u001b[36m 1\u001b[39m\u001b(B\u001b[m560 S 0.0 0.0 0:00.00 sh /mnt/c/Users/alv_t/.vscode/extensions/ms-vscode-remote\u001b[21;4H39 mrmarble 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m612 600 532 S 0.0 0.0 0:00.00 sh /home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683\u001b[22;4H44 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:00.00 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[23;4H\u001b[39m\u001b(B\u001b[m45 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:03.82 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[24;4H\u001b[39m\u001b(B\u001b[m46 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:03.75 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[25;4H\u001b[39m\u001b(B\u001b[m47 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:03.76 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[26;4H\u001b[39m\u001b(B\u001b[m48 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:03.69 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[27;4H\u001b[39m\u001b(B\u001b[m49 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:00.00 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[28;4H\u001b[39m\u001b(B\u001b[m50 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:02.70 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[29;4H\u001b[39m\u001b(B\u001b[m51 mrmarble 20 0 \u001b[36m 919M 91\u001b[39m\u001b(B\u001b[m708 \u001b[36m32\u001b[39m\u001b(B\u001b[m760 S 0.0 1.1 0:02.70 \u001b[32m/home/mrmarble/.vscode-server/bin/b5205cc8eb4fbaa72683553\u001b[30;1H\u001b[39m\u001b(B\u001b[mF1\u001b[30m\u001b[46mHelp \u001b[39;49m\u001b(B\u001b[mF2\u001b[30m\u001b[46mSetup \u001b[39;49m\u001b(B\u001b[mF3\u001b[30m\u001b[46mSearch\u001b[39;49m\u001b(B\u001b[mF4\u001b[30m\u001b[46mFilter\u001b[39;49m\u001b(B\u001b[mF5\u001b[30m\u001b[46mTree \u001b[39;49m\u001b(B\u001b[mF6\u001b[30m\u001b[46mSortBy\u001b[39;49m\u001b(B\u001b[mF7\u001b[30m\u001b[46mNice -\u001b[39;49m\u001b(B\u001b[mF8\u001b[30m\u001b[46mNice +\u001b[39;49m\u001b(B\u001b[mF9\u001b[30m\u001b[46mKill \u001b[39;49m\u001b(B\u001b[mF10\u001b[30m\u001b[46mQuit\u001b[K\u001b[H\u001b[39;49m\u001b(B\u001b[m"] 13 | [4.099,"o","\u001b[14;29r\u001b[14;1H\u001b[4T\u001b[1;30r\u001b[3;94H\u001b(B\u001b[0;1m\u001b[90m\u001b[17X\u001b[3;111H0.0%\u001b[10;76H\u001b[36m5\u001b[13;2H\u001b(B\u001b[0m\u001b[30m\u001b[46m3192\u001b[13;25H1484M 9476 2880 S 2.0 0.1\u001b[61G15 ./../swatch/swatch examples/session.svg\u001b[14;2H\u001b[39;49m\u001b(B\u001b[m3198 mrmarble 20 0 \u001b[36m1484M 9\u001b[39m\u001b(B\u001b[m476 \u001b[36m 2\u001b[39m\u001b(B\u001b[m880 S 0.7 0.1 0:00.02 \u001b[32m./../swatch/swatch examples/session.svg\u001b[15;2H\u001b[39m\u001b(B\u001b[m3374 mrmarble 20 0 \u001b[36m1484M 9\u001b[39m\u001b(B\u001b[m476 \u001b[36m 2\u001b[39m\u001b(B\u001b[m880 S 0.7 0.1 0:00.01 \u001b[32m./../swatch/swatch examples/session.svg\u001b[16;2H\u001b[39m\u001b(B\u001b[m3557 \u001b(B\u001b[0;1m\u001b[90mroot \u001b[39m\u001b(B\u001b[m 20 0 \u001b[36m 2\u001b[39m\u001b(B\u001b[m512 560 0 S 0.7 0.0 0:00.01 /init\r\u001b[17d 4385 mrmarble 20 0 \u001b[36m 8\u001b[39m\u001b(B\u001b[m284 \u001b[36m 3\u001b[39m\u001b(B\u001b[m688 \u001b[36m 3\u001b[39m\u001b(B\u001b[m028 \u001b[32mR \u001b[39m\u001b(B\u001b[m 0.0 0.0 0:00.01 htop\u001b[H"] 14 | [5.603,"o","\u001b[3;94H\u001b[31m|\u001b[113G\u001b(B\u001b[0;1m\u001b[90m7\u001b[10;76H\u001b[36m6\u001b[13;46H\u001b(B\u001b[0m\u001b[30m\u001b[46m0\u001b[14;48H\u001b[39;49m\u001b(B\u001b[m0\u001b[15d\u00080\u001b[16d\u00080\u001b[H"] 15 | [6.153,"o","\u001b[?1000l\u001b[30;1H\u001b[?12l\u001b[?25h\u001b[?1049l\u001b[23;0;0t\r\u001b[?1l\u001b\u003e"] 16 | [6.154,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 17 | [6.175,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;31m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K\u001b[?1h\u001b=\u001b[?2004h"] 18 | [6.805,"o","\u001b[4me\u001b[24m\u0008\u001b[4me\u001b[24m\u001b[90mxit\u001b[39m\u0008\u0008\u0008"] 19 | [6.989,"o","\u0008\u001b[24m\u001b[32me\u001b[32mx\u001b[39m"] 20 | [7.12,"o","\u0008\u0008\u001b[1m\u001b[31me\u001b[1m\u001b[31mx\u001b[1m\u001b[31mi\u001b[0m\u001b[39m"] 21 | [7.214,"o","\u0008\u0008\u0008\u001b[0m\u001b[32me\u001b[0m\u001b[32mx\u001b[0m\u001b[32mi\u001b[32mt\u001b[39m"] 22 | [7.438,"o","\u001b[?1l\u001b\u003e"] 23 | [7.439,"o","\u001b[?2004l\r\r\n\u001b]2;exit\u0007\u001b]1;exit\u0007"] -------------------------------------------------------------------------------- /examples/256colors.cast: -------------------------------------------------------------------------------- 1 | {"version":2,"width":120,"height":42,"timestamp":1647092161,"duration":10.296995,"env":{"SHELL":"/usr/bin/zsh","TERM":"xterm-256color"}} 2 | [0.442473,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r"] 3 | [0.442493,"o","\u001b]2;mrmarble@founder:~/repos/termsvg\u0007"] 4 | [0.442515,"o","\u001b]1;~/repos/termsvg\u0007"] 5 | [0.465364,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K"] 6 | [0.465466,"o","\u001b[?1h\u001b="] 7 | [0.465774,"o","\u001b[?2004h"] 8 | [1.921296,"o","\u001b[4mc\u001b[24m"] 9 | [1.922085,"o","\u0008\u001b[4mc\u001b[24m\u001b[90md repos/termsvg\u001b[39m\u001b[15D"] 10 | [2.172367,"o","\u0008\u001b[24m\u001b[1m\u001b[31mc\u001b[1m\u001b[31mu\u001b[0m\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[14D"] 11 | [2.172859,"o","\u001b[90mrl -s https://gist.githubusercontent.com/WoLpH/8b6f697ecc06318004728b8c0127d9b3/raw/colortes\u001b[90mt\u001b[90m.py | python3\u001b[39m\u001b[K\u001b[A\u001b[14C"] 12 | [2.722262,"o","\u0008\u0008\u001b[1m\u001b[31mc\u001b[1m\u001b[31mu\u001b[1m\u001b[31mr\u001b[0m\u001b[39m"] 13 | [2.895835,"o","\u0008\u0008\u0008\u001b[0m\u001b[32mc\u001b[0m\u001b[32mu\u001b[0m\u001b[32mr\u001b[32ml\u001b[39m"] 14 | [3.095827,"o","\u001b[39m "] 15 | [3.446299,"o","\u001b[39m-"] 16 | [3.846085,"o","\u001b[39ms"] 17 | [4.947344,"o","\u001b[39m \u001b[39mh\u001b[39mt\u001b[39mt\u001b[39mp\u001b[39ms\u001b[39m:\u001b[39m/\u001b[39m/\u001b[39mg\u001b[39mi\u001b[39ms\u001b[39mt\u001b[39m.\u001b[39mg\u001b[39mi\u001b[39mt\u001b[39mh\u001b[39mu\u001b[39mb\u001b[39mu\u001b[39ms\u001b[39me\u001b[39mr\u001b[39mc\u001b[39mo\u001b[39mn\u001b[39mt\u001b[39me\u001b[39mn\u001b[39mt\u001b[39m.\u001b[39mc\u001b[39mo\u001b[39mm\u001b[39m/\u001b[39mW\u001b[39mo\u001b[39mL\u001b[39mp\u001b[39mH\u001b[39m/\u001b[39m8\u001b[39mb\u001b[39m6\u001b[39mf\u001b[39m6\u001b[39m9\u001b[39m7\u001b[39me\u001b[39mc\u001b[39mc\u001b[39m0\u001b[39m6\u001b[39m3\u001b[39m1\u001b[39m8\u001b[39m0\u001b[39m0\u001b[39m4\u001b[39m7\u001b[39m2\u001b[39m8\u001b[39mb\u001b[39m8\u001b[39mc\u001b[39m0\u001b[39m1\u001b[39m2\u001b[39m7\u001b[39md\u001b[39m9\u001b[39mb\u001b[39m3\u001b[39m/\u001b[39mr\u001b[39ma\u001b[39mw\u001b[39m/\u001b[39mc\u001b[39mo\u001b[39ml\u001b[39mo\u001b[39mr\u001b[39mt\u001b[39me\u001b[39mst\u001b[39m.\u001b[39mp\u001b[39my\u001b[39m \u001b[39m|\u001b[39m \u001b[32mp\u001b[32my\u001b[32mt\u001b[32mh\u001b[32mo\u001b[32mn\u001b[32m3\u001b[39m"] 18 | [7.195759,"o","\u001b[?1l\u001b\u003e"] 19 | [7.197583,"o","\u001b[?2004l\r\r\n"] 20 | [7.197885,"o","\u001b]2;curl -s | python3\u0007\u001b]1;curl\u0007"] 21 | [7.262589,"o","\u001b[38;5;255m\u001b[48;5;16m 16 00/00/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;17m 17 00/00/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;18m 18 00/00/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;19m 19 00/00/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;20m 20 00/00/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;21m 21 00/00/FF \u001b[0m\r\n\u001b[38;5;255m\u001b[48;5;22m 22 00/5F/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;23m 23 00/5F/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;24m 24 00/5F/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;25m 25 00/5F/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;26m 26 00/5F/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;27m 27 00/5F/FF \u001b[0m\r\n"] 22 | [7.262671,"o","\u001b[38;5;255m\u001b[48;5;28m 28 00/87/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;29m 29 00/87/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;30m 30 00/87/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;31m 31 00/87/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;32m 32 00/87/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;33m 33 00/87/FF \u001b[0m\r\n"] 23 | [7.262723,"o","\u001b[38;5;255m\u001b[48;5;34m 34 00/AF/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;35m 35 00/AF/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;36m 36 00/AF/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;37m 37 00/AF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;38m 38 00/AF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;39m 39 00/AF/FF \u001b[0m\r\n\u001b[38;5;0m\u001b[48;5;40m 40 00/D7/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;41m 41 00/D7/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;42m 42 00/D7/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;43m 43 00/D7/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;44m 44 00/D7/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;45m 45 00/D7/FF \u001b[0m\r\n"] 24 | [7.262792,"o","\u001b[38;5;0m\u001b[48;5;46m 46 00/FF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;47m 47 00/FF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;48m 48 00/FF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;49m 49 00/FF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;50m 50 00/FF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;51m 51 00/FF/FF \u001b[0m\r\n\u001b[38;5;255m\u001b[48;5;52m 52 5F/00/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;53m 53 5F/00/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;54m 54 5F/00/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;55m 55 5F/00/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;56m 56 5F/00/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;57m 57 5F/00/FF \u001b[0m\r\n"] 25 | [7.262874,"o","\u001b[38;5;255m\u001b[48;5;58m 58 5F/5F/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;59m 59 5F/5F/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;60m 60 5F/5F/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;61m 61 5F/5F/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;62m 62 5F/5F/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;63m 63 5F/5F/FF \u001b[0m\r\n\u001b[38;5;255m\u001b[48;5;64m 64 5F/87/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;65m 65 5F/87/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;66m 66 5F/87/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;67m 67 5F/87/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;68m 68 5F/87/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;69m 69 5F/87/FF \u001b[0m\r\n"] 26 | [7.262972,"o","\u001b[38;5;255m\u001b[48;5;70m 70 5F/AF/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;71m 71 5F/AF/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;72m 72 5F/AF/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;73m 73 5F/AF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;74m 74 5F/AF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;75m 75 5F/AF/FF \u001b[0m\r\n"] 27 | [7.263053,"o","\u001b[38;5;0m\u001b[48;5;76m 76 5F/D7/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;77m 77 5F/D7/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;78m 78 5F/D7/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;79m 79 5F/D7/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;80m 80 5F/D7/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;81m 81 5F/D7/FF \u001b[0m\r\n"] 28 | [7.263107,"o","\u001b[38;5;0m\u001b[48;5;82m 82 5F/FF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;83m 83 5F/FF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;84m 84 5F/FF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;85m 85 5F/FF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;86m 86 5F/FF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;87m 87 5F/FF/FF \u001b[0m\r\n"] 29 | [7.263188,"o","\u001b[38;5;255m\u001b[48;5;88m 88 87/00/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;89m 89 87/00/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;90m 90 87/00/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;91m 91 87/00/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;92m 92 87/00/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;93m 93 87/00/FF \u001b[0m\r\n\u001b[38;5;255m\u001b[48;5;94m 94 87/5F/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;95m 95 87/5F/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;96m 96 87/5F/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;97m 97 87/5F/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;98m 98 87/5F/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;99m 99 87/5F/FF \u001b[0m\r\n"] 30 | [7.263279,"o","\u001b[38;5;255m\u001b[48;5;100m 100 87/87/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;101m 101 87/87/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;102m 102 87/87/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;103m 103 87/87/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;104m 104 87/87/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;105m 105 87/87/FF \u001b[0m\r\n\u001b[38;5;255m\u001b[48;5;106m 106 87/AF/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;107m 107 87/AF/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;108m 108 87/AF/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;109m 109 87/AF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;110m 110 87/AF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;111m 111 87/AF/FF \u001b[0m\r\n"] 31 | [7.263351,"o","\u001b[38;5;0m\u001b[48;5;112m 112 87/D7/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;113m 113 87/D7/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;114m 114 87/D7/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;115m 115 87/D7/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;116m 116 87/D7/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;117m 117 87/D7/FF \u001b[0m\r\n"] 32 | [7.263362,"o","\u001b[38;5;0m\u001b[48;5;118m 118 87/FF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;119m 119 87/FF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;120m 120 87/FF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;121m 121 87/FF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;122m 122 87/FF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;123m 123 87/FF/FF \u001b[0m\r\n"] 33 | [7.263457,"o","\u001b[38;5;255m\u001b[48;5;124m 124 AF/00/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;125m 125 AF/00/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;126m 126 AF/00/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;127m 127 AF/00/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;128m 128 AF/00/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;129m 129 AF/00/FF \u001b[0m\r\n"] 34 | [7.263529,"o","\u001b[38;5;255m\u001b[48;5;130m 130 AF/5F/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;131m 131 AF/5F/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;132m 132 AF/5F/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;133m 133 AF/5F/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;134m 134 AF/5F/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;135m 135 AF/5F/FF \u001b[0m\r\n"] 35 | [7.263542,"o","\u001b[38;5;255m\u001b[48;5;136m 136 AF/87/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;137m 137 AF/87/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;138m 138 AF/87/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;139m 139 AF/87/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;140m 140 AF/87/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;141m 141 AF/87/FF \u001b[0m\r\n"] 36 | [7.263645,"o","\u001b[38;5;255m\u001b[48;5;142m 142 AF/AF/00 \u001b[0m \u001b[38;5;255m\u001b[48;5;143m 143 AF/AF/5F \u001b[0m \u001b[38;5;255m\u001b[48;5;144m 144 AF/AF/87 \u001b[0m \u001b[38;5;255m\u001b[48;5;145m 145 AF/AF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;146m 146 AF/AF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;147m 147 AF/AF/FF \u001b[0m\r\n"] 37 | [7.26375,"o","\u001b[38;5;0m\u001b[48;5;148m 148 AF/D7/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;149m 149 AF/D7/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;150m 150 AF/D7/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;151m 151 AF/D7/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;152m 152 AF/D7/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;153m 153 AF/D7/FF \u001b[0m\r\n\u001b[38;5;0m\u001b[48;5;154m 154 AF/FF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;155m 155 AF/FF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;156m 156 AF/FF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;157m 157 AF/FF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;158m 158 AF/FF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;159m 159 AF/FF/FF \u001b[0m\r\n"] 38 | [7.263856,"o","\u001b[38;5;0m\u001b[48;5;160m 160 D7/00/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;161m 161 D7/00/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;162m 162 D7/00/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;163m 163 D7/00/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;164m 164 D7/00/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;165m 165 D7/00/FF \u001b[0m\r\n\u001b[38;5;0m\u001b[48;5;166m 166 D7/5F/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;167m 167 D7/5F/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;168m 168 D7/5F/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;169m 169 D7/5F/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;170m 170 D7/5F/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;171m 171 D7/5F/FF \u001b[0m\r\n"] 39 | [7.26396,"o","\u001b[38;5;0m\u001b[48;5;172m 172 D7/87/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;173m 173 D7/87/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;174m 174 D7/87/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;175m 175 D7/87/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;176m 176 D7/87/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;177m 177 D7/87/FF \u001b[0m\r\n\u001b[38;5;0m\u001b[48;5;178m 178 D7/AF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;179m 179 D7/AF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;180m 180 D7/AF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;181m 181 D7/AF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;182m 182 D7/AF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;183m 183 D7/AF/FF \u001b[0m\r\n"] 40 | [7.264044,"o","\u001b[38;5;0m\u001b[48;5;184m 184 D7/D7/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;185m 185 D7/D7/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;186m 186 D7/D7/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;187m 187 D7/D7/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;188m 188 D7/D7/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;189m 189 D7/D7/FF \u001b[0m\r\n\u001b[38;5;0m\u001b[48;5;190m 190 D7/FF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;191m 191 D7/FF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;192m 192 D7/FF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;193m 193 D7/FF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;194m 194 D7/FF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;195m 195 D7/FF/FF \u001b[0m\r\n"] 41 | [7.264142,"o","\u001b[38;5;0m\u001b[48;5;196m 196 FF/00/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;197m 197 FF/00/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;198m 198 FF/00/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;199m 199 FF/00/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;200m 200 FF/00/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;201m 201 FF/00/FF \u001b[0m\r\n"] 42 | [7.264232,"o","\u001b[38;5;0m\u001b[48;5;202m 202 FF/5F/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;203m 203 FF/5F/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;204m 204 FF/5F/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;205m 205 FF/5F/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;206m 206 FF/5F/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;207m 207 FF/5F/FF \u001b[0m\r\n\u001b[38;5;0m\u001b[48;5;208m 208 FF/87/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;209m 209 FF/87/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;210m 210 FF/87/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;211m 211 FF/87/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;212m 212 FF/87/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;213m 213 FF/87/FF \u001b[0m\r\n"] 43 | [7.2643,"o","\u001b[38;5;0m\u001b[48;5;214m 214 FF/AF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;215m 215 FF/AF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;216m 216 FF/AF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;217m 217 FF/AF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;218m 218 FF/AF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;219m 219 FF/AF/FF \u001b[0m\r\n"] 44 | [7.264313,"o","\u001b[38;5;0m\u001b[48;5;220m 220 FF/D7/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;221m 221 FF/D7/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;222m 222 FF/D7/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;223m 223 FF/D7/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;224m 224 FF/D7/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;225m 225 FF/D7/FF \u001b[0m\r\n"] 45 | [7.264407,"o","\u001b[38;5;0m\u001b[48;5;226m 226 FF/FF/00 \u001b[0m \u001b[38;5;0m\u001b[48;5;227m 227 FF/FF/5F \u001b[0m \u001b[38;5;0m\u001b[48;5;228m 228 FF/FF/87 \u001b[0m \u001b[38;5;0m\u001b[48;5;229m 229 FF/FF/AF \u001b[0m \u001b[38;5;0m\u001b[48;5;230m 230 FF/FF/D7 \u001b[0m \u001b[38;5;0m\u001b[48;5;231m 231 FF/FF/FF \u001b[0m\r\n"] 46 | [7.264487,"o","\u001b[38;5;255m\u001b[48;5;232m 232 08/08/08 \u001b[0m \u001b[38;5;255m\u001b[48;5;233m 233 12/12/12 \u001b[0m \u001b[38;5;255m\u001b[48;5;234m 234 1C/1C/1C \u001b[0m \u001b[38;5;255m\u001b[48;5;235m 235 26/26/26 \u001b[0m \u001b[38;5;255m\u001b[48;5;236m 236 30/30/30 \u001b[0m \u001b[38;5;255m\u001b[48;5;237m 237 3A/3A/3A \u001b[0m\r\n"] 47 | [7.264513,"o","\u001b[38;5;255m\u001b[48;5;238m 238 44/44/44 \u001b[0m \u001b[38;5;255m\u001b[48;5;239m 239 4E/4E/4E \u001b[0m \u001b[38;5;255m\u001b[48;5;240m 240 58/58/58 \u001b[0m \u001b[38;5;255m\u001b[48;5;241m 241 62/62/62 \u001b[0m \u001b[38;5;255m\u001b[48;5;242m 242 6C/6C/6C \u001b[0m \u001b[38;5;255m\u001b[48;5;243m 243 76/76/76 \u001b[0m\r\n"] 48 | [7.26457,"o","\u001b[38;5;255m\u001b[48;5;244m 244 80/80/80 \u001b[0m \u001b[38;5;255m\u001b[48;5;245m 245 8A/8A/8A \u001b[0m \u001b[38;5;255m\u001b[48;5;246m 246 94/94/94 \u001b[0m \u001b[38;5;255m\u001b[48;5;247m 247 9E/9E/9E \u001b[0m \u001b[38;5;255m\u001b[48;5;248m 248 A8/A8/A8 \u001b[0m \u001b[38;5;255m\u001b[48;5;249m 249 B2/B2/B2 \u001b[0m\r\n"] 49 | [7.264657,"o","\u001b[38;5;255m\u001b[48;5;250m 250 BC/BC/BC \u001b[0m \u001b[38;5;255m\u001b[48;5;251m 251 C6/C6/C6 \u001b[0m \u001b[38;5;0m\u001b[48;5;252m 252 D0/D0/D0 \u001b[0m \u001b[38;5;0m\u001b[48;5;253m 253 DA/DA/DA \u001b[0m \u001b[38;5;0m\u001b[48;5;254m 254 E4/E4/E4 \u001b[0m \u001b[38;5;0m\u001b[48;5;255m 255 EE/EE/EE \u001b[0m\r\n"] 50 | [7.267284,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r"] 51 | [7.267378,"o","\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 52 | [7.287736,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K"] 53 | [7.287848,"o","\u001b[?1h\u001b="] 54 | [7.288259,"o","\u001b[?2004h"] 55 | [9.671749,"o","\u001b[4me\u001b[24m"] 56 | [9.672449,"o","\u0008\u001b[4me\u001b[24m\u001b[90mxit\u001b[39m\u0008\u0008\u0008"] 57 | [9.845889,"o","\u0008\u001b[24m\u001b[32me\u001b[32mx\u001b[39m"] 58 | [9.971578,"o","\u0008\u0008\u001b[1m\u001b[31me\u001b[1m\u001b[31mx\u001b[1m\u001b[31mi\u001b[0m\u001b[39m"] 59 | [10.096186,"o","\u0008\u0008\u0008\u001b[0m\u001b[32me\u001b[0m\u001b[32mx\u001b[0m\u001b[32mi\u001b[32mt\u001b[39m"] 60 | [10.295964,"o","\u001b[?1l\u001b\u003e"] 61 | [10.296633,"o","\u001b[?2004l\r\r\n"] 62 | [10.296995,"o","\u001b]2;exit\u0007\u001b]1;exit\u0007"] -------------------------------------------------------------------------------- /examples/session.cast: -------------------------------------------------------------------------------- 1 | {"version":2,"width":120,"height":30,"timestamp":1646492752,"duration":34.765,"env":{"SHELL":"/usr/bin/zsh","TERM":"xterm-256color"}} 2 | [0.444,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 3 | [0.467,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K\u001b[?1h\u001b="] 4 | [0.468,"o","\u001b[?2004h"] 5 | [4.534,"o","\u001b[32ml\u001b[39m\u0008\u001b[32ml\u001b[39m\u001b[90ms\u001b[39m\u0008"] 6 | [4.615,"o","\u0008\u001b[32ml\u001b[32ml\u001b[39m"] 7 | [5.56,"o"," "] 8 | [5.561,"o","\u001b[90mscripts\u001b[39m\u0008\u0008\u0008\u0008\u0008\u0008\u0008"] 9 | [6.057,"o","\u001b[39m|\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u0008\u0008\u0008\u0008\u0008\u0008"] 10 | [6.671,"o"," "] 11 | [7.227,"o","\u001b[32ml\u001b[39m"] 12 | [7.355,"o","\u0008\u001b[1m\u001b[31ml\u001b[1m\u001b[31mo\u001b[0m\u001b[39m"] 13 | [7.595,"o","\u0008\u001b[1m\u001b[31mo\u001b[1m\u001b[31ml\u001b[0m\u001b[39m"] 14 | [7.64,"o","\u0008\u001b[1m\u001b[31ml\u001b[1m\u001b[31mc\u001b[0m\u001b[39m"] 15 | [7.79,"o","\u0008\u001b[1m\u001b[31mc\u001b[1m\u001b[31ma\u001b[0m\u001b[39m"] 16 | [7.975,"o","\u0008\u0008\u0008\u0008\u0008\u001b[0m\u001b[32ml\u001b[0m\u001b[32mo\u001b[0m\u001b[32ml\u001b[0m\u001b[32mc\u001b[0m\u001b[32ma\u001b[32mt\u001b[39m"] 17 | [8.469,"o","\u001b[?1l\u001b\u003e"] 18 | [8.471,"o","\u001b[?2004l\r\r\n\u001b]2;ls --color=tty -lh | lolcat\u0007\u001b]1;ll\u0007"] 19 | [8.518,"o","\u001b[38;5;48mt\u001b[0m\u001b[38;5;84mo\u001b[0m\u001b[38;5;83mt\u001b[0m\u001b[38;5;83ma\u001b[0m\u001b[38;5;83ml\u001b[0m\u001b[38;5;83m \u001b[0m\u001b[38;5;83m2\u001b[0m\u001b[38;5;83m2\u001b[0m\u001b[38;5;83mM\u001b[0m\r\n\u001b[38;5;83m-\u001b[0m\u001b[38;5;83mr\u001b[0m\u001b[38;5;83mw\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;83mr\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;83mr\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;119m \u001b[0m\u001b[38;5;118m1\u001b[0m\u001b[38;5;118m \u001b[0m\u001b[38;5;118mm\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118mm\u001b[0m\u001b[38;5;118ma\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118mb\u001b[0m\u001b[38;5;118ml\u001b[0m\u001b[38;5;154me\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mm\u001b[0m"] 20 | [8.519,"o","\u001b[38;5;154ma\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mb\u001b[0m\u001b[38;5;154ml\u001b[0m\u001b[38;5;148me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m1\u001b[0m\u001b[38;5;184m.\u001b[0m\u001b[38;5;184m1\u001b[0m\u001b[38;5;184mK\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mF\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m2\u001b[0m\u001b[38;5;178m5\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m3\u001b[0m\u001b[38;5;214m:\u001b[0m\u001b[38;5;214m4\u001b[0m\u001b[38;5;214m2\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mL\u001b[0m\u001b[38;5;214mI\u001b[0m\u001b[38;5;208mC\u001b[0m\u001b[38;5;208mE\u001b[0m\u001b[38;5;208mN\u001b[0m\u001b[38;5;208mS\u001b[0m\u001b[38;5;208mE\u001b[0m\r\n\u001b[38;5;83m-\u001b[0m\u001b[38;5;83mr\u001b[0m\u001b[38;5;83mw\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;83mr\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;119mr\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118m \u001b[0m\u001b[38;5;118m1\u001b[0m\u001b[38;5;118m \u001b[0m\u001b[38;5;118mm\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118mm\u001b[0m\u001b[38;5;118ma\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mb\u001b[0m\u001b[38;5;154ml\u001b[0m"] 21 | [8.52,"o","\u001b[38;5;154me\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154ma\u001b[0m\u001b[38;5;148mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m9\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mF\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;178mb\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m2\u001b[0m\u001b[38;5;214m5\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m3\u001b[0m\u001b[38;5;214m:\u001b[0m\u001b[38;5;214m4\u001b[0m\u001b[38;5;214m2\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mR\u001b[0m\u001b[38;5;208mE\u001b[0m\u001b[38;5;208mA\u001b[0m\u001b[38;5;208mD\u001b[0m\u001b[38;5;208mM\u001b[0m\u001b[38;5;208mE\u001b[0m\u001b[38;5;208m.\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208md\u001b[0m\r\n\u001b[38;5;83m-\u001b[0m\u001b[38;5;83mr\u001b[0m\u001b[38;5;83mw\u001b[0m\u001b[38;5;83m-\u001b[0m\u001b[38;5;119mr\u001b[0m\u001b[38;5;118m-\u001b[0m"] 22 | [8.521,"o","\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118m \u001b[0m\u001b[38;5;118m1\u001b[0m\u001b[38;5;118m \u001b[0m\u001b[38;5;118mm\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154ma\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mb\u001b[0m\u001b[38;5;154ml\u001b[0m\u001b[38;5;154me\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;148mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m2\u001b[0m\u001b[38;5;184m.\u001b[0m\u001b[38;5;184m0\u001b[0m\u001b[38;5;184mK\u001b[0m\u001b[38;5;178m \u001b[0m\u001b[38;5;214mM\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m5\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m5\u001b[0m\u001b[38;5;208m:\u001b[0m\u001b[38;5;208m5\u001b[0m\u001b[38;5;208m5\u001b[0m"] 23 | [8.522,"o","\u001b[38;5;208m \u001b[0m\u001b[38;5;208mT\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208ms\u001b[0m\u001b[38;5;208mk\u001b[0m\u001b[38;5;208mf\u001b[0m\u001b[38;5;208mi\u001b[0m\u001b[38;5;209ml\u001b[0m\u001b[38;5;203me\u001b[0m\u001b[38;5;203m.\u001b[0m\u001b[38;5;203my\u001b[0m\u001b[38;5;203mm\u001b[0m\u001b[38;5;203ml\u001b[0m\r\n\u001b[38;5;83md\u001b[0m\u001b[38;5;119mr\u001b[0m\u001b[38;5;118mw\u001b[0m\u001b[38;5;118mx\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mx\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mx\u001b[0m\u001b[38;5;118m \u001b[0m\u001b[38;5;154m3\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154ma\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mb\u001b[0m"] 24 | [8.523,"o","\u001b[38;5;154ml\u001b[0m\u001b[38;5;148me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m4\u001b[0m\u001b[38;5;178m.\u001b[0m\u001b[38;5;214m0\u001b[0m\u001b[38;5;214mK\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mF\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m6\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m1\u001b[0m\u001b[38;5;208m0\u001b[0m\u001b[38;5;208m:\u001b[0m\u001b[38;5;208m5\u001b[0m\u001b[38;5;208m2\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mc\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208md\u001b[0m\r\n\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118mw\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154m1\u001b[0m"] 25 | [8.524,"o","\u001b[38;5;154m \u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;154ma\u001b[0m\u001b[38;5;148mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;178me\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m8\u001b[0m\u001b[38;5;214mK\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mM\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m5\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m1\u001b[0m\u001b[38;5;208m5\u001b[0m\u001b[38;5;208m:\u001b[0m\u001b[38;5;208m5\u001b[0m\u001b[38;5;208m2\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;209mc\u001b[0m\u001b[38;5;203mo\u001b[0m\u001b[38;5;203mv\u001b[0m\u001b[38;5;203me\u001b[0m\u001b[38;5;203mr\u001b[0m\u001b[38;5;203ma\u001b[0m\u001b[38;5;203mg\u001b[0m\u001b[38;5;203me\u001b[0m\u001b[38;5;203m.\u001b[0m\u001b[38;5;203mt\u001b[0m\u001b[38;5;203mx\u001b[0m\u001b[38;5;203mt\u001b[0m\r\n"] 26 | [8.525,"o","\u001b[38;5;118md\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;118mw\u001b[0m\u001b[38;5;118mx\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mx\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mx\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154m7\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;154mm\u001b[0m\u001b[38;5;148mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;178mr\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214ml\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m4\u001b[0m\u001b[38;5;214m.\u001b[0m\u001b[38;5;214m0\u001b[0m\u001b[38;5;214mK\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;208mF\u001b[0m\u001b[38;5;208me\u001b[0m\u001b[38;5;208mb\u001b[0m"] 27 | [8.526,"o","\u001b[38;5;208m \u001b[0m\u001b[38;5;208m2\u001b[0m\u001b[38;5;208m5\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m1\u001b[0m\u001b[38;5;208m3\u001b[0m\u001b[38;5;208m:\u001b[0m\u001b[38;5;209m4\u001b[0m\u001b[38;5;203m3\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203md\u001b[0m\u001b[38;5;203mi\u001b[0m\u001b[38;5;203ms\u001b[0m\u001b[38;5;203mt\u001b[0m\r\n\u001b[38;5;118m-\u001b[0m\u001b[38;5;118mr\u001b[0m\u001b[38;5;154mw\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154m \u001b[0m\u001b[38;5;148m1\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;184me\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;178mr\u001b[0m\u001b[38;5;214mm\u001b[0m"] 28 | [8.527,"o","\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214ml\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m6\u001b[0m\u001b[38;5;208m2\u001b[0m\u001b[38;5;208m6\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mM\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m4\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;209m2\u001b[0m\u001b[38;5;203m2\u001b[0m\u001b[38;5;203m:\u001b[0m\u001b[38;5;203m3\u001b[0m\u001b[38;5;203m9\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203mg\u001b[0m\u001b[38;5;203mo\u001b[0m\u001b[38;5;203m.\u001b[0m\u001b[38;5;203mm\u001b[0m\u001b[38;5;203mo\u001b[0m\u001b[38;5;203md\u001b[0m\r\n"] 29 | [8.528,"o","\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mw\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;148m-\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m1\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mb\u001b[0m\u001b[38;5;184ml\u001b[0m\u001b[38;5;178me\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214ml\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m8\u001b[0m\u001b[38;5;208m.\u001b[0m\u001b[38;5;208m2\u001b[0m\u001b[38;5;208mK\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mM\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208mr\u001b[0m"] 30 | [8.529,"o","\u001b[38;5;208m \u001b[0m\u001b[38;5;209m \u001b[0m\u001b[38;5;203m4\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m2\u001b[0m\u001b[38;5;203m2\u001b[0m\u001b[38;5;203m:\u001b[0m\u001b[38;5;203m3\u001b[0m\u001b[38;5;203m9\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203mg\u001b[0m\u001b[38;5;203mo\u001b[0m\u001b[38;5;203m.\u001b[0m\u001b[38;5;198ms\u001b[0m\u001b[38;5;198mu\u001b[0m\u001b[38;5;198mm\u001b[0m\r\n\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;154mw\u001b[0m\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;148m-\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m1\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;184ma\u001b[0m\u001b[38;5;178mr\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214ml\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;208mb\u001b[0m\u001b[38;5;208ml\u001b[0m\u001b[38;5;208me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m8\u001b[0m\u001b[38;5;208m9\u001b[0m\u001b[38;5;208m0\u001b[0m"] 31 | [8.53,"o","\u001b[38;5;208m \u001b[0m\u001b[38;5;208mF\u001b[0m\u001b[38;5;209me\u001b[0m\u001b[38;5;203mb\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m2\u001b[0m\u001b[38;5;203m5\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m1\u001b[0m\u001b[38;5;203m3\u001b[0m\u001b[38;5;203m:\u001b[0m\u001b[38;5;203m4\u001b[0m\u001b[38;5;203m1\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;198mg\u001b[0m\u001b[38;5;198mo\u001b[0m\u001b[38;5;198mr\u001b[0m\u001b[38;5;198me\u001b[0m\u001b[38;5;198ml\u001b[0m\u001b[38;5;198me\u001b[0m\u001b[38;5;198ma\u001b[0m\u001b[38;5;198ms\u001b[0m\u001b[38;5;198me\u001b[0m\u001b[38;5;198mr\u001b[0m\u001b[38;5;199m.\u001b[0m\u001b[38;5;199my\u001b[0m\u001b[38;5;199mm\u001b[0m\u001b[38;5;199ml\u001b[0m\r\n\u001b[38;5;154m-\u001b[0m\u001b[38;5;154mr\u001b[0m\u001b[38;5;148mw\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184m1\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;184mm\u001b[0m\u001b[38;5;178mr\u001b[0m"] 32 | [8.531,"o","\u001b[38;5;214mm\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214ml\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208mb\u001b[0m\u001b[38;5;208ml\u001b[0m\u001b[38;5;208me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208m1\u001b[0m\u001b[38;5;208m7\u001b[0m\u001b[38;5;209mM\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203mM\u001b[0m\u001b[38;5;203ma\u001b[0m\u001b[38;5;203mr\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m5\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m1\u001b[0m\u001b[38;5;203m6\u001b[0m\u001b[38;5;203m:\u001b[0m\u001b[38;5;198m0\u001b[0m\u001b[38;5;198m2\u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198mp\u001b[0m\u001b[38;5;198mi\u001b[0m\u001b[38;5;198mp\u001b[0m\u001b[38;5;198me\u001b[0m\u001b[38;5;198ms\u001b[0m\u001b[38;5;198m.\u001b[0m\u001b[38;5;198mc\u001b[0m"] 33 | [8.532,"o","\u001b[38;5;199ma\u001b[0m\u001b[38;5;199ms\u001b[0m\u001b[38;5;199mt\u001b[0m\u001b[38;5;199m.\u001b[0m\u001b[38;5;199ms\u001b[0m\u001b[38;5;199mv\u001b[0m\u001b[38;5;199mg\u001b[0m\r\n\u001b[38;5;184md\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mw\u001b[0m\u001b[38;5;184mx\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mx\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mx\u001b[0m\u001b[38;5;184m \u001b[0m\u001b[38;5;178m6\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mb\u001b[0m\u001b[38;5;214ml\u001b[0m\u001b[38;5;214me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208mb\u001b[0m\u001b[38;5;208ml\u001b[0m\u001b[38;5;208me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;209m4\u001b[0m"] 34 | [8.533,"o","\u001b[38;5;203m.\u001b[0m\u001b[38;5;203m0\u001b[0m\u001b[38;5;203mK\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203mM\u001b[0m\u001b[38;5;203ma\u001b[0m\u001b[38;5;203mr\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m5\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;198m1\u001b[0m\u001b[38;5;198m4\u001b[0m\u001b[38;5;198m:\u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;198m7\u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198mp\u001b[0m\u001b[38;5;198mk\u001b[0m\u001b[38;5;198mg\u001b[0m\r\n\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mw\u001b[0m\u001b[38;5;184mx\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mx\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;178m-\u001b[0m\u001b[38;5;214mx\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214ma\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;208mb\u001b[0m\u001b[38;5;208ml\u001b[0m\u001b[38;5;208me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208mr\u001b[0m"] 35 | [8.534,"o","\u001b[38;5;208mb\u001b[0m\u001b[38;5;209ml\u001b[0m\u001b[38;5;203me\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m3\u001b[0m\u001b[38;5;203m.\u001b[0m\u001b[38;5;203m6\u001b[0m\u001b[38;5;203mK\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203mM\u001b[0m\u001b[38;5;203ma\u001b[0m\u001b[38;5;203mr\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198m1\u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;198m:\u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;198m7\u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198ms\u001b[0m\u001b[38;5;199me\u001b[0m\u001b[38;5;199ms\u001b[0m\u001b[38;5;199ms\u001b[0m\u001b[38;5;199mi\u001b[0m\u001b[38;5;199mo\u001b[0m\u001b[38;5;199mn\u001b[0m\u001b[38;5;199m.\u001b[0m\u001b[38;5;199mc\u001b[0m\u001b[38;5;199ma\u001b[0m\u001b[38;5;163ms\u001b[0m\u001b[38;5;164mt\u001b[0m\r\n\u001b[38;5;184m-\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;184mw\u001b[0m\u001b[38;5;184mx\u001b[0m\u001b[38;5;184mr\u001b[0m\u001b[38;5;178m-\u001b[0m"] 36 | [8.535,"o","\u001b[38;5;214mx\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;214m-\u001b[0m\u001b[38;5;214mx\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214m1\u001b[0m\u001b[38;5;214m \u001b[0m\u001b[38;5;214mm\u001b[0m\u001b[38;5;214mr\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208ma\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208mb\u001b[0m\u001b[38;5;208ml\u001b[0m\u001b[38;5;208me\u001b[0m\u001b[38;5;208m \u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;208mr\u001b[0m\u001b[38;5;208mm\u001b[0m\u001b[38;5;209ma\u001b[0m\u001b[38;5;203mr\u001b[0m\u001b[38;5;203mb\u001b[0m\u001b[38;5;203ml\u001b[0m\u001b[38;5;203me\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203m4\u001b[0m\u001b[38;5;203m.\u001b[0m\u001b[38;5;203m7\u001b[0m\u001b[38;5;203mM\u001b[0m\u001b[38;5;203m \u001b[0m\u001b[38;5;203mM\u001b[0m\u001b[38;5;198ma\u001b[0m\u001b[38;5;198mr\u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;198m \u001b[0m\u001b[38;5;198m1\u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;198m:\u001b[0m\u001b[38;5;198m5\u001b[0m\u001b[38;5;199m2\u001b[0m\u001b[38;5;199m \u001b[0m\u001b[38;5;199mt\u001b[0m\u001b[38;5;199me\u001b[0m\u001b[38;5;199mr\u001b[0m\u001b[38;5;199mm\u001b[0m\u001b[38;5;199ms\u001b[0m\u001b[38;5;199mv\u001b[0m\u001b[38;5;199mg\u001b[0m\r\n"] 37 | [8.537,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 38 | [8.557,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K"] 39 | [8.558,"o","\u001b[?1h\u001b=\u001b[?2004h"] 40 | [15.904,"o","\u001b[4mc\u001b[24m"] 41 | [15.905,"o","\u0008\u001b[4mc\u001b[24m\u001b[90mlear\u001b[39m\u0008\u0008\u0008\u0008"] 42 | [16.069,"o","\u0008\u001b[24m\u001b[1m\u001b[31mc\u001b[1m\u001b[31ma\u001b[0m\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u0008\u0008\u0008"] 43 | [16.07,"o","\u001b[90mt go.mod\u001b[39m\u001b[8D"] 44 | [16.3,"o","\u0008\u0008\u001b[0m\u001b[32mc\u001b[0m\u001b[32ma\u001b[32mt\u001b[39m"] 45 | [17.994,"o","\u001b[39m "] 46 | [19.074,"o","\u001b[39m\u001b[4mg\u001b[39m\u001b[4mo\u001b[39m\u001b[4m.\u001b[39m\u001b[4mm\u001b[39m\u001b[4mo\u001b[39m\u001b[4md\u001b[24m"] 47 | [19.704,"o","\u001b[?1l\u001b\u003e"] 48 | [19.705,"o","\u001b[?2004l\r\r\n\u001b]2;cat go.mod\u0007\u001b]1;cat\u0007"] 49 | [19.706,"o","module github.com/mrmarble/termsvg\r\n\r\ngo 1.17\r\n\r\nrequire (\r\n\tgithub.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b\r\n\tgithub.com/creack/pty v1.1.17\r\n\tgithub.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02\r\n\tgolang.org/x/term v0.0.0-20210927222741-03fcf44c2211\r\n)\r\n\r\nrequire (\r\n\tgithub.com/mattn/go-colorable v0.1.9 // indirect\r\n\tgithub.com/mattn/go-isatty v0.0.14 // indirect\r\n\tgithub.com/pkg/errors v0.9.1 // indirect\r\n)\r\n\r\nrequire (\r\n\tgithub.com/alecthomas/kong v0.4.1\r\n\tgithub.com/fatih/color v1.13.0\r\n\tgithub.com/google/go-cmp v0.5.7\r\n\tgithub.com/rs/zerolog v1.26.1\r\n\tgolang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect\r\n)\r\n\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r"] 50 | [19.707,"o","\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 51 | [19.728,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K\u001b[?1h\u001b=\u001b[?2004h"] 52 | [26.764,"o","\u001b[4mp\u001b[24m\u0008\u001b[4mp\u001b[24m\u001b[90mipes.sh\u001b[39m\u0008\u0008\u0008\u0008\u0008\u0008\u0008"] 53 | [26.974,"o","\u0008\u001b[24m\u001b[1m\u001b[31mp\u001b[1m\u001b[31mi\u001b[0m\u001b[39m"] 54 | [27.185,"o","\u0008\u0008\u001b[1m\u001b[31mp\u001b[1m\u001b[31mi\u001b[1m\u001b[31mn\u001b[0m\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u0008\u0008\u0008\u0008\u0008"] 55 | [27.186,"o","\u001b[90mg elite\u001b[39m\u0008\u0008\u0008\u0008\u0008\u0008\u0008"] 56 | [27.294,"o","\u0008\u0008\u0008\u001b[0m\u001b[32mp\u001b[0m\u001b[32mi\u001b[0m\u001b[32mn\u001b[32mg\u001b[39m"] 57 | [27.684,"o","\u001b[39m "] 58 | [28,"o","\u001b[39ml\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u0008\u0008\u0008\u0008"] 59 | [28.12,"o","o"] 60 | [28.212,"o","c"] 61 | [28.375,"o","a"] 62 | [28.69,"o","l"] 63 | [28.885,"o","h"] 64 | [28.945,"o","o"] 65 | [29.051,"o","s"] 66 | [29.169,"o","t"] 67 | [29.381,"o","\u001b[?1l\u001b\u003e"] 68 | [29.382,"o","\u001b[?2004l\r\r\n\u001b]2;ping localhost\u0007\u001b]1;ping\u0007"] 69 | [29.39,"o","PING localhost (127.0.0.1) 56(84) bytes of data.\r\n"] 70 | [29.391,"o","64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.191 ms\r\n"] 71 | [30.435,"o","64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.031 ms\r\n"] 72 | [31.475,"o","64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.032 ms\r\n"] 73 | [32.515,"o","64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.035 ms\r\n"] 74 | [32.858,"o","^C\r\n--- localhost ping statistics ---\r\n4 packets transmitted, 4 received, 0% packet loss, time 3125ms\r\nrtt min/avg/max/mdev = 0.031/0.072/0.191/0.068 ms\r\n"] 75 | [32.859,"o","\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r\u001b]2;mrmarble@founder:~/repos/termsvg\u0007\u001b]1;~/repos/termsvg\u0007"] 76 | [32.879,"o","\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[01;32m➜ \u001b[36mtermsvg\u001b[00m \u001b[01;34mgit:(\u001b[31mmaster\u001b[34m) \u001b[33m✗\u001b[00m \u001b[K\u001b[?1h\u001b="] 77 | [32.88,"o","\u001b[?2004h"] 78 | [33.785,"o","\u001b[1m\u001b[31me\u001b[0m\u001b[39m\u0008\u001b[1m\u001b[31me\u001b[0m\u001b[39m\u001b[90mxplorer.exe .\u001b[39m\u001b[13D"] 79 | [34.029,"o","\u0008\u001b[0m\u001b[32me\u001b[32mx\u001b[39m"] 80 | [34.22,"o","\u0008\u0008\u001b[1m\u001b[31me\u001b[1m\u001b[31mx\u001b[1m\u001b[31mi\u001b[0m\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[11D"] 81 | [34.221,"o","\u001b[90mt\u001b[39m\u0008"] 82 | [34.315,"o","\u0008\u0008\u0008\u001b[0m\u001b[32me\u001b[0m\u001b[32mx\u001b[0m\u001b[32mi\u001b[32mt\u001b[39m"] 83 | [34.764,"o","\u001b[?1l\u001b\u003e"] 84 | [34.765,"o","\u001b[?2004l\r\r\n\u001b]2;exit\u0007\u001b]1;exit\u0007"] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------