Skip to content

Instantly share code, notes, and snippets.

@geofft
Created August 12, 2025 13:22
Show Gist options
  • Select an option

  • Save geofft/c7826633cf36898248cc491d9512a29c to your computer and use it in GitHub Desktop.

Select an option

Save geofft/c7826633cf36898248cc491d9512a29c to your computer and use it in GitHub Desktop.
Use VS Code themes on the Linux VT (text mode) console
#!/usr/bin/env python3
#
# Use VS Code themes on the Linux VT (text mode) console. I use this with the themes from
# https://github.com/liviuschera/noctis
# Usage:
# 1) Download a theme JSON file
# 2) python vscode-theme-to-linux-vt.py theme.json | sh
# - or -
# 2) python vscode-theme-to-linux-vt.py theme.json > theme.sh
# 3) chmod +x theme.sh
# 4) add it to your startup scripts
#
# Public domain / CC0
import json
import sys
COLORKEYS = [
prefix + color
for prefix in ["terminal.ansi", "terminal.ansiBright"]
for color in ["Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White"]
]
def main():
if len(sys.argv) != 2:
sys.exit("usage: vscode-theme-to-linux-vt.py theme.json")
theme = json.load(open(sys.argv[1]))
print("#!/bin/sh")
for i, color in enumerate(COLORKEYS):
hexcode = theme["colors"][color]
r = int(hexcode[1:3], 16)
g = int(hexcode[3:5], 16)
b = int(hexcode[5:7], 16)
print(f"setpalette {i} {r} {g} {b}")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment