Closed lukechilds closed 6 years ago
Thanks for the report @lukechilds. Looks like an issue that is caused by term-schemes
not being able to read the theme from ~/.hyper.js
.
Could you share the theme-related parts of your config?
This kind of thing could be prevented by defaulting to builtin themes via #9
Thanks for the fast response!
Yeah sure:
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
shell: '/usr/local/bin/zsh',
fontSize: 12,
fontFamily: 'Menlo',
cursorBlink: true,
cursorColor: '#8AB3B5',
hyperlinks: {
clickAction: 'ignore'
},
base16: {
scheme: 'mocha'
}
},
plugins: [
'hyperlinks-iterm',
'hyper-search',
'hypersixteen'
],
};
Reverting the config to:
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
shell: '/usr/local/bin/zsh',
fontSize: 12,
fontFamily: 'Menlo',
cursorBlink: true,
cursorColor: '#8AB3B5',
}
};
doesn't solve the issue if that's any help
oh, I totally forgot to mention, also tried on Terminal.app:
svg-term --cast=113643 --out examples/parrot.svg
/Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/lib/cli.js:355
throw err;
^
TypeError: Missing ANSIBlackColor
at toRGB (/Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/node_modules/term-schemes/lib/parsers/terminal.js:45:15)
at terminal (/Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/node_modules/term-schemes/lib/parsers/terminal.js:19:12)
at extractTheme (/Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/lib/cli.js:310:20)
at getTheme (/Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/lib/cli.js:277:11)
at /Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/lib/cli.js:147:23
at Generator.next (<anonymous>)
at fulfilled (/Users/lukechilds/.nvm/versions/node/v9.3.0/lib/node_modules/svg-term-cli/lib/cli.js:5:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
@lukechilds: Thanks for reporting, I'll definitely will have to invest some time into the hyper
theme parser. Any chance you can share the color profile Terminal.app
is configured to use?
Terminal.app is completely standard.
I don't think it's to do with hyper, both terminals are giving a very similar error on the same line.
svg-term-cli/lib/cli.js:355
Hyper says TypeError: Cannot use 'in' operator to search for 'black' in undefined
While Terminal.app says TypeError: Missing ANSIBlackColor
So something to do with the color black, independent of terminal types 🤔
Ok, took quite a dive into this and there were a number of problems that caused your issues
Cannot use 'in' operator to search for 'black' in undefined
term-schemes
assumed .config.colors
always to be an object. It now ensures there is no TypeError thrown if this assumption is broken. Fixing this surfaced the next issue.
plugins[]
were not handled, so hypersixteen
would have no effect at all. term-schemes.hyper
now contains a minimal implementation of the Hyper
plugin mechanism. This yields the expeceted config
term-schemes
tends to be very strict about accepted input. This meant enforcing all required colors to be defined explicitly. Hyper
in contrast uses default settings and "just works". I adapted the term-schemes.hyper
parser to default to the known defaults of Hyper
Basically the same story as with Hyper
defaults.
NSColorSpaces
term-schemes.terminal
now handles all NSColorSpaces
variants found in the default Terminal.app profiles.
# in any terminal
svg-term --cast 113643 --term=terminal --profile="Basic" --window
# in any terminal, with hypersixteen configured to mocha
svg-term --cast 113643 --term=hyper --window
# in any terminal, with default config in hyper.js
svg-term --cast 113643 --term=hyper --no-cursor --window
Closing this for now, let's open focused issues if something of this type crops up again and reference this issue
Thanks so much for looking into this.
How did you achieve number 2? That's exactly what I'm looking for!
I tried:
$ svg-term --cast 113643 --term hyper --profile ~/.hyper.js --window
Share terminal sessions as razor-sharp animated SVG everywhere
Usage
$ svg-term [options]
Options
--at timestamp of frame to render in ms [number]
--cast asciinema cast id to download [string], required if no stdin provided [string]
--from lower range of timeline to render in ms [number]
--height height in lines [number]
--help print this help [boolean]
--in json file to use as input [string]
--no-cursor disable cursor rendering [boolean]
--no-optimize disable svgo optimization [boolean]
--out output file, emits to stdout if omitted, [string]
--padding distance between text and image bounds, [number]
--padding-x distance between text and image bounds on x axis [number]
--padding-y distance between text and image bounds on y axis [number]
--profile terminal profile file to use, requires --term [string]
--term terminal profile format [iterm2, xrdb, xresources, terminator, konsole, terminal, remmina, termite, tilda, xcfe], requires --profile [string]
--to upper range of timeline to render in ms [number]
--width width in columns [number]
--window render with window decorations [boolean]
Examples
$ cat rec.json | svg-term
$ svg-term --cast 113643
$ svg-term --cast 113643 --out examples/parrot.svg
svg-term: term expected to be one of hyper, iterm2, konsole, remmina, terminal, terminator, termite, tilda, xcfe, xresources, xterm, received "hyper"
Essentially trying to end up with something like this: https://i.imgur.com/DSeOCee.gif
But not a 15mb GIF!
I have it on asciinema https://asciinema.org/a/RjJDZRRUESBCnPko2Qh1jd6CS
Apologies if it's something dumb in my setup but I'm wracking my brains trying to get this to work.
Also I only recently setup a new Mac so I don't have a particularly strange setup.
Are you sure you use the latest svg-term
version?
$ svg-term --version
2.0.5
Sorry, didn't realised you published a new version since opening this issue.
Hmmn, now I'm getting:
$ svg-term --cast=113643 --out examples/parrot.svg
/Users/lukechilds/.config/yarn/global/node_modules/svg-term-cli/lib/cli.js:356
throw err;
^
Error: Cannot find module 'electron'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/lukechilds/.hyper_plugins/node_modules/hyperlinks-iterm/index.js:1:81)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
Okay, thats the plugin resolver in term-schemes
acting up - could you disable all plugins except hypersixteen
?
That did the trick, thanks so much for your help!
Thank you for raising all those issues, this helps me improving the tool a lot :)
Trying one of the examples I just get:
I've tested on
2.0.4
,2.0.3
and2.1.0-1
. All give me the same error.