OmarTawfik / terminal-screenshot

Render terminal ANSI output into images!
MIT License
9 stars 2 forks source link

How to set a color scheme/theme? #8

Open edouard-lopez opened 6 months ago

edouard-lopez commented 6 months ago

related: #11

Hello, thanks for your time invested in the project! I'm using it to generate screenshots of the various features in pure.fish prompt documentation.

I would like to take screenshot using a light theme like ayu or a base16. How would one do that?

edouard-lopez commented 6 months ago

Looking around I fund the https://github.com/ysk2014/xterm-theme project that exposes theme's object and allow to do:

import { Terminal } from 'xterm';
import { ayu } from 'xterm-theme';

import xtermTheme from 'xterm-theme';

const terminal = new Terminal({
    theme: ayu
});
OmarTawfik commented 6 months ago

Good idea. Maybe we can add an options.theme to replace options.backgroundColor .. I suggest accepting the xterm's theme object (link). I'm a bit skeptic about depending on the xterm-theme package. It is a 5 years old package with no real usage or known contributors. But the suggestion above would permit users of terminal-screenshot to leverage xterm-theme if they want, and forward its data along.