SSH Term All themes

SSH Term theme format v1

SSH Term reads terminal color themes as JSON in this format, from a file, the clipboard or a theme link. You can write one by hand or make one with your own tool.

JSON Schema (2020-12): https://sshterm.iru-yo.com/themes/schema/v1.json

Checking in an editor

Put "$schema" with the schema’s URL at the top of the file, as in the example at the end. VS Code and other editors then complete and check it. The app reads past "$schema" when it is this URL and refuses any other value.

The file

One JSON object with these fields. A file holds 1 to 32 themes.

FieldValue
$schemaOptional. Only the schema’s URL.
formatAlways "ssh-term-theme".
formatVersion1. A file of a newer version is refused, asking to update the app.
themesAn array of 1 to 32 themes.

A theme

FieldValue
idA UUID v4 in lowercase. Give each new theme a new random one: a theme sent again with the same id is offered as a replacement for the one the reader has.
nameThe theme’s name.
authorWho made it.
licenseCC0-1.0, CC-BY-4.0 or MIT (see Licenses).
basedOnOptional. The theme this one was made from, one step back: its name, author and license. For one of the app’s presets, its name alone.
colorsThe colors, below.

Colors

Write a color as #RRGGBB or #RRGGBBAA (alpha last, as in CSS), in upper or lower case, with no spaces. Foreground, background and the 16 ANSI colors are required; the app fills in the others when they are missing. The app itself writes all 23, and #RRGGBB when a color is opaque.

KeyColorWhen missing
foregroundForeground (text)Required
backgroundBackgroundRequired
cursorCursorThe foreground
selectionSelectionThe foreground at 40% opacity (alpha 66)
blackANSI 0Required
redANSI 1Required
greenANSI 2Required
yellowANSI 3Required
blueANSI 4Required
magentaANSI 5Required
cyanANSI 6Required
whiteANSI 7Required
brightBlackANSI 8Required
brightRedANSI 9Required
brightGreenANSI 10Required
brightYellowANSI 11Required
brightBlueANSI 12Required
brightMagentaANSI 13Required
brightCyanANSI 14Required
brightWhiteANSI 15Required
searchHitBackgroundSearch hits#FFB86C
searchHitBackgroundCurrentThe current search hit#FF79C6
searchHitForegroundText of search hits#282A36

Rules

The app, the theme link page and the theme gallery check the same rules. The schema says all of them but the file size, the trimming of names and the unique ids.

  • A file is at most 64 KB (65,536 bytes of UTF-8).
  • No fields other than the ones above, at any level. null is not a value: leave an optional field out instead.
  • Names and authors (also in basedOn) lose their surrounding white space, then are 1 to 40 characters (Unicode code points).
  • They are plain text: no control characters (U+0000–U+001F, U+007F–U+009F) and none that turn the direction of text (U+061C, U+200E, U+200F, U+202A–U+202E, U+2066–U+2069).
  • The themes of a file each have their own id.
  • A file with a required color missing or a color written wrong is refused, naming the color.

Licenses

Pick one of these SPDX IDs, written exactly so:

  • CC0-1.0: anyone may use and change the theme, without credit.
  • CC-BY-4.0 (the app’s default): anyone may use and change it, crediting you.
  • MIT: anyone may use and change it, keeping the copyright and license notice.

When you make a theme from someone else’s, put theirs in basedOn. If theirs is CC-BY-4.0 or MIT, yours keeps the same license; if it is CC0-1.0, choose any.

Theme links

A theme link opens one theme in SSH Term: https://sshterm.iru-yo.com/theme#t=… where t is a v1 file holding one theme, compressed with deflate-raw (DEFLATE without a zlib or gzip header) and written in base64url without padding. The part after # never reaches the server.

It must expand to no more than 64 KB. In JavaScript (browsers and Node):

In Python:

From Windows Terminal and iTerm2

SSH Term also reads a Windows Terminal color scheme (JSON) and an iTerm2 .itermcolors file; the author is added in the app. To convert one yourself, take the colors from these keys:

v1Windows TerminaliTerm2
foregroundforegroundForeground Color
backgroundbackgroundBackground Color
cursorcursorColorCursor Color
selectionselectionBackgroundSelection Color
blackblackAnsi 0 Color
redredAnsi 1 Color
greengreenAnsi 2 Color
yellowyellowAnsi 3 Color
blueblueAnsi 4 Color
magentapurpleAnsi 5 Color
cyancyanAnsi 6 Color
whitewhiteAnsi 7 Color
brightBlackbrightBlackAnsi 8 Color
brightRedbrightRedAnsi 9 Color
brightGreenbrightGreenAnsi 10 Color
brightYellowbrightYellowAnsi 11 Color
brightBluebrightBlueAnsi 12 Color
brightMagentabrightPurpleAnsi 13 Color
brightCyanbrightCyanAnsi 14 Color
brightWhitebrightWhiteAnsi 15 Color

iTerm2 gives each component as a number from 0 to 1: multiply it by 255 and round. Its Alpha Component, if there, is the alpha. The search hit colors have no counterpart: leave them out. An opaque selection color would hide the text under it, so SSH Term writes it with alpha 66 (40% opacity): do the same.

Example

A file with one theme:

{
  "$schema": "https://sshterm.iru-yo.com/themes/schema/v1.json",
  "format": "ssh-term-theme",
  "formatVersion": 1,
  "themes": [
    {
      "id": "8b0e5c3a-2f6d-4e91-a7c4-5d1f0b9e3a62",
      "name": "Harbor Night",
      "author": "SSH Term",
      "license": "CC0-1.0",
      "basedOn": {
        "name": "Dracula"
      },
      "colors": {
        "foreground": "#E6E8EF",
        "background": "#14181F",
        "cursor": "#7FD1C7",
        "selection": "#E6E8EF66",
        "black": "#1C222B",
        "red": "#E86A6A",
        "green": "#7FCB8A",
        "yellow": "#E8C66A",
        "blue": "#6A9FE8",
        "magenta": "#C08AE6",
        "cyan": "#6ACFD8",
        "white": "#C9CED8",
        "brightBlack": "#4A5363",
        "brightRed": "#F28B8B",
        "brightGreen": "#9BE0A5",
        "brightYellow": "#F2D88B",
        "brightBlue": "#8BB8F2",
        "brightMagenta": "#D4A8F0",
        "brightCyan": "#8BE3EA",
        "brightWhite": "#F4F6FA",
        "searchHitBackground": "#FFB86C",
        "searchHitBackgroundCurrent": "#FF79C6",
        "searchHitForeground": "#282A36"
      }
    }
  ]
}

Download example.json

sshterm.iru-yo.com/themes/format