Custom Terminal Background Images in WebShell

Custom Terminal Background Images in WebShell

3月 6, 2023 · 1 分钟阅读时长 · 89 字 · -阅读 -评论

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

Alan H
Authors
开发者,数码产品爱好者,喜欢折腾,喜欢分享,喜欢开源