Custom Terminal Background Images in WebShell

· 1 min read · 89 Words · -Views -Comments

WebShell recently added support for custom background images. Here’s the overall approach.

Architecture

https://static.1991421.cn/2023/2023-03-06-235223.jpeg

As the diagram shows, the implementation is roughly:

  1. xterm.js supports transparent backgrounds; set the terminal background to transparent.
  2. Add a sibling DOM element in front of the terminal and apply a background image to it via CSS. This becomes the visual “bottom layer” beneath the terminal, with opacity controlling transparency.
  3. Set the terminal’s parent element to a solid color without transparency.

With the above, you get a custom terminal background image with adjustable transparency.

Demo

Link

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover