terminal-preview is a collection of JavaScript and CSS that will enable parsing and styling of terminal ANSI escape codes for simple preview. It’s been developed as a result of my experimenting with bash-ps1 and image-to-ansi.

I’d wanted to extract the code I used in the those projects into a stand-alone project/component that could be added to an existing page where ANSI escape sequences need to be interpreted. I’ve toyed with the idea of making it a Web Component or something like that but haven’t just yet.

Continue reading “terminal-preview”

Convert an image to ANSI escape codes

I’ve been working on cleaning up my dotfiles recently and have been playing with my PS1 and the available colours. In doing so I thought it might be interesting to extract image data from an uploaded image and turn the result into a nearest-match ANSI image. This is the result! It supports both 256 colour and true colour terminals and can utilise unicode code points to present a clear image in slightly fewer pixels as well as just using background colours and spaces if preferred.

It includes a live preview which I’ve lifted from the bash PS1 parser.

Check it out here!