marionebl / svg-term

Share terminal sessions via SVG and CSS
MIT License
137 stars 15 forks source link

Allow overriding part of the theme #8

Open gaborcsardi opened 5 years ago

gaborcsardi commented 5 years ago

E.g. this currently does not work:

  const theme = { lineHeight: 1.0 };
  const result = render(input, { theme: theme });

It will create a bad SVG.

marionebl commented 5 years ago

This is more or less consistent with SVGTermTheme:

https://github.com/marionebl/svg-term/blob/3d0c4a8b77348153a4fa5ff70b4cc1bc763b3503/src/index.tsx#L40-L63

Back when designing the interface I assumed users wold provide complete themes instead of providing partial ones (see svg-term-cli, which uses term-schemes to derive those). I'd lean towards keeping it this way for the sake of simplicity.

We should consider some runtime validation of passed themes, failing if a partial theme has been detected. Thoughts?

gaborcsardi commented 5 years ago

I think it is fine to keep it like this, but then maybe you could export the default theme? To make it easy to just change the line height or the font, while keeping the default theme.

marionebl commented 5 years ago

Yes, let’s do that then