diff --git a/colorschemes/Makefile b/colorschemes/Makefile new file mode 100644 index 0000000..52b08a3 --- /dev/null +++ b/colorschemes/Makefile @@ -0,0 +1,25 @@ +# https://tech.davis-hansson.com/p/make/ +SHELL := bash +.ONESHELL: +.SHELLFLAGS := -eu -o pipefail -c +.DELETE_ON_ERROR: +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules + +.PHONY: all clean + +OUT_DIR := out +OUT_FILES := iterm.itermcolors kitty.conf vim.vim setvtrgb.txt zsh.zsh termux.properties variables.css colorscheme.scss prismjs-theme.css vscode-colorCustomizations.json xfce4-terminal.theme + +all: $(OUT_DIR) $(addprefix $(OUT_DIR)/,$(OUT_FILES)) + +clean: + rm -rv $(OUT_DIR) + +$(OUT_DIR): + mkdir -p $@ + +$(OUT_DIR)/%: %.py _theme.py $(OUT_DIR) + python3 ./$< > $@ + +$(OUT_DIR)/prismjs-theme.css: prismjs-theme-src.css diff --git a/colorschemes/_theme.py b/colorschemes/_theme.py new file mode 100644 index 0000000..0fb8671 --- /dev/null +++ b/colorschemes/_theme.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 + +# base16-eighties by Chris Kempson (http://chriskempson.com) +base16_name = "eighties" +name = "base16-" + base16_name +is_dark = True +base16_colors = [ + "#2d2d2d", # 0 + "#393939", # 1 + "#515151", # 2 + "#747369", # 3 + "#a09f93", # 4 + "#d3d0c8", # 5 + "#e8e6df", # 6 + "#f2f0ec", # 7 + "#f2777a", # 8 + "#f99157", # 9 + "#ffcc66", # a + "#99cc99", # b + "#66cccc", # c + "#6699cc", # d + "#cc99cc", # e + "#d27b53", # f +] + +bg = base16_colors[0x0] +fg = base16_colors[0x5] + +cursor_bg = fg +cursor_fg = bg + +selection_bg = base16_colors[0x2] +selection_fg = fg + +ansi_colors = [ + base16_colors[int(i, 16)] for i in "0 8 B A D E C 5 3 8 B A D E C 7 9 F 1 2 4 6".split() +] + +link_color = ansi_colors[0xC] + +css_variables_prefix = "dotfiles-colorscheme-" +css_variables = { + "bg": bg, + "fg": fg, + "selection-bg": selection_bg, + "selection-fg": selection_fg, + "cursor-bg": cursor_bg, + "cursor-fg": cursor_fg, + **{"base-{:02X}".format(index): color for index, color in enumerate(base16_colors)}, +} diff --git a/colorschemes/colorscheme.scss.py b/colorschemes/colorscheme.scss.py new file mode 100755 index 0000000..9eff318 --- /dev/null +++ b/colorschemes/colorscheme.scss.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +# TODO: Prefix the name with an underscore when I rewrite the theme generator, +# see . + +import _theme as theme + + +print('$is-dark: {};'.format("true" if theme.is_dark else "false")) +for var_name, color in theme.css_variables.items(): + print("${}: {};".format(var_name, color)) +print("$base: ({});".format(', '.join(theme.base16_colors))) +print("$ansi: ({});".format(', '.join(theme.ansi_colors))) diff --git a/colorschemes/iterm.itermcolors.py b/colorschemes/iterm.itermcolors.py new file mode 100755 index 0000000..8cd59e5 --- /dev/null +++ b/colorschemes/iterm.itermcolors.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +print( + """\ + + + +\ +""" +) + + +def print_color(key_name, color): + r, g, b = [float(int(color[2 * i + 1:2 * i + 3], 16)) / 255 for i in range(3)] + print( + """\ + {} Color + + Color Space + sRGB + Red Component + {} + Green Component + {} + Blue Component + {} + \ +""".format(key_name, r, g, b) + ) + + +print_color("Background", theme.bg) +print_color("Foreground", theme.fg) +print_color("Bold", theme.fg) +print_color("Cursor", theme.cursor_bg) +print_color("Cursor Text", theme.cursor_fg) +print_color("Selection Color", theme.selection_bg) +print_color("Selected Text Color", theme.selection_fg) +for index, color in enumerate(theme.ansi_colors[:16]): + print_color("Ansi " + str(index), color) +print_color("Link", theme.link_color) + +print("""\ + +\ +""") diff --git a/colorschemes/kitty.conf.py b/colorschemes/kitty.conf.py new file mode 100755 index 0000000..81544aa --- /dev/null +++ b/colorschemes/kitty.conf.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +def print_color(key_name, color): + print("{} {}".format(key_name, color)) + + +print_color("background", theme.bg) +print_color("foreground", theme.fg) +print_color("cursor", theme.cursor_bg) +print_color("cursor_text_color", theme.cursor_fg) +print_color("selection_background", theme.selection_bg) +print_color("selection_foreground", theme.selection_fg) +for index, color in enumerate(theme.ansi_colors[:16]): + print_color("color" + str(index), color) +print_color("url_color", theme.link_color) + +print_color("active_border_color", theme.ansi_colors[2]) +print_color("inactive_border_color", theme.ansi_colors[8]) +print_color("bell_border_color", theme.ansi_colors[1]) + +print_color("active_tab_foreground", theme.base16_colors[0x1]) +print_color("active_tab_background", theme.base16_colors[0xB]) +print_color("inactive_tab_foreground", theme.base16_colors[0x4]) +print_color("inactive_tab_background", theme.base16_colors[0x1]) +print_color("tab_bar_background", theme.base16_colors[0x1]) diff --git a/colorschemes/main.py b/colorschemes/main.py deleted file mode 100755 index 11e34ee..0000000 --- a/colorschemes/main.py +++ /dev/null @@ -1,436 +0,0 @@ -#!/usr/bin/env python3 - -import json -import os -from abc import abstractmethod -from typing import Dict, Iterable, List, Protocol, TextIO, runtime_checkable - - -__dir__ = os.path.dirname(__file__) - - -class Color: - - def __init__(self, r: int, g: int, b: int) -> None: - assert 0 <= r <= 0xff - assert 0 <= g <= 0xff - assert 0 <= b <= 0xff - self.r = r - self.g = g - self.b = b - - @classmethod - def from_hex(cls, s: str) -> "Color": - assert len(s) == 6 - return Color(int(s[0:2], 16), int(s[2:4], 16), int(s[4:6], 16)) - - @property - def css_hex(self) -> str: - return "#{:02x}{:02x}{:02x}".format(self.r, self.g, self.b) - - @property - def hex(self) -> str: - return "{:02x}{:02x}{:02x}".format(self.r, self.g, self.b) - - def __getitem__(self, index: int) -> int: - if index == 0: - return self.r - elif index == 1: - return self.g - elif index == 2: - return self.b - else: - raise IndexError("color component index out of range") - - def __iter__(self) -> Iterable[int]: - yield self.r - yield self.g - yield self.b - - -BASE16_TO_ANSI_MAPPING: List[int] = [ - 0x0, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x5, # 0x0 - 0x3, 0x8, 0xB, 0xA, 0xD, 0xE, 0xC, 0x7, # 0x8 - 0x9, 0xF, 0x1, 0x2, 0x4, 0x6, # 0x10 -] # yapf: disable - -ANSI_TO_BASE16_MAPPING: List[int] = [BASE16_TO_ANSI_MAPPING.index(i) for i in range(16)] - - -@runtime_checkable -class Theme(Protocol): - - @property - @abstractmethod - def base16_name(self) -> str: - raise NotImplementedError() - - @property - @abstractmethod - def is_dark(self) -> bool: - raise NotImplementedError() - - @property - @abstractmethod - def base16_colors(self) -> List[Color]: - raise NotImplementedError() - - @property - def name(self) -> str: - return "base16-{}".format(self.base16_name) - - @property - def bg(self) -> Color: - return self.base16_colors[0x0] - - @property - def fg(self) -> Color: - return self.base16_colors[0x5] - - @property - def cursor_bg(self) -> Color: - return self.fg - - @property - def cursor_fg(self) -> Color: - return self.bg - - @property - def selection_bg(self) -> Color: - return self.base16_colors[0x2] - - @property - def selection_fg(self) -> Color: - return self.fg - - @property - def ansi_colors(self) -> List[Color]: - return [self.base16_colors[i] for i in BASE16_TO_ANSI_MAPPING] - - @property - def link_color(self) -> Color: - return self.ansi_colors[0xC] - - @property - def css_variables(self) -> Dict[str, Color]: - d = { - "bg": self.bg, - "fg": self.fg, - "selection-bg": self.selection_bg, - "selection-fg": self.selection_fg, - "cursor-bg": self.cursor_bg, - "cursor-fg": self.cursor_fg, - } - for index, color in enumerate(self.base16_colors): - d["base-{:02X}".format(index)] = color - return d - - -class MyTheme(Theme): - base16_name = "eighties" - is_dark = True - base16_colors = [ - Color.from_hex("2d2d2d"), # 0 - Color.from_hex("393939"), # 1 - Color.from_hex("515151"), # 2 - Color.from_hex("747369"), # 3 - Color.from_hex("a09f93"), # 4 - Color.from_hex("d3d0c8"), # 5 - Color.from_hex("e8e6df"), # 6 - Color.from_hex("f2f0ec"), # 7 - Color.from_hex("f2777a"), # 8 - Color.from_hex("f99157"), # 9 - Color.from_hex("ffcc66"), # a - Color.from_hex("99cc99"), # b - Color.from_hex("66cccc"), # c - Color.from_hex("6699cc"), # d - Color.from_hex("cc99cc"), # e - Color.from_hex("d27b53"), # f - ] - - -@runtime_checkable -class ThemeGenerator(Protocol): - - @abstractmethod - def file_name(self) -> str: - raise NotImplementedError() - - @abstractmethod - def generate(self, theme: Theme, output: TextIO) -> None: - raise NotImplementedError() - - -class ThemeGeneratorKitty(ThemeGenerator): - - def file_name(self) -> str: - return "kitty.conf" - - def generate(self, theme: Theme, output: TextIO) -> None: - - def write_color(key_name: str, color: Color) -> None: - output.write("{} {}\n".format(key_name, color.css_hex)) - - write_color("background", theme.bg) - write_color("foreground", theme.fg) - write_color("cursor", theme.cursor_bg) - write_color("cursor_text_color", theme.cursor_fg) - write_color("selection_background", theme.selection_bg) - write_color("selection_foreground", theme.selection_fg) - for index, color in enumerate(theme.ansi_colors[:16]): - write_color("color{}".format(index), color) - write_color("url_color", theme.link_color) - - write_color("active_border_color", theme.ansi_colors[2]) - write_color("inactive_border_color", theme.ansi_colors[8]) - write_color("bell_border_color", theme.ansi_colors[1]) - - write_color("active_tab_foreground", theme.base16_colors[0x1]) - write_color("active_tab_background", theme.base16_colors[0xB]) - write_color("inactive_tab_foreground", theme.base16_colors[0x4]) - write_color("inactive_tab_background", theme.base16_colors[0x1]) - write_color("tab_bar_background", theme.base16_colors[0x1]) - - -class ThemeGeneratorTermux(ThemeGenerator): - - def file_name(self) -> str: - return "termux.properties" - - def generate(self, theme: Theme, output: TextIO) -> None: - - def write_color(key_name: str, color: Color) -> None: - output.write("{}={}\n".format(key_name, color.css_hex)) - - write_color("background", theme.bg) - write_color("foreground", theme.fg) - write_color("cursor", theme.cursor_bg) - for index, color in enumerate(theme.ansi_colors[:16]): - write_color("color{}".format(index), color) - - -class ThemeGeneratorZsh(ThemeGenerator): - - def file_name(self) -> str: - return "zsh.zsh" - - def generate(self, theme: Theme, output: TextIO) -> None: - - def write_color(key_name: str, color: Color) -> None: - output.write("colorscheme_{}={}\n".format(key_name, color.hex)) - - write_color("bg", theme.bg) - write_color("fg", theme.fg) - write_color("cursor_bg", theme.cursor_bg) - write_color("cursor_fg", theme.cursor_fg) - write_color("selection_bg", theme.selection_bg) - write_color("selection_fg", theme.selection_fg) - write_color("link_color", theme.link_color) - - output.write("colorscheme_ansi_colors=(\n") - for color in theme.ansi_colors: - output.write(" {}\n".format(color.hex)) - output.write(")\n") - - -class ThemeGeneratorVim(ThemeGenerator): - - def file_name(self) -> str: - return "vim.vim" - - def generate(self, theme: Theme, output: TextIO) -> None: - namespace = "dotfiles_colorscheme_" - output.write("let {}name = '{}'\n".format(namespace, theme.name)) - output.write("let {}base16_name = '{}'\n".format(namespace, theme.base16_name)) - output.write("let {}base16_colors = [\n".format(namespace)) - for gui_color, cterm_color in zip(theme.base16_colors, ANSI_TO_BASE16_MAPPING): - output.write( - "\\ {{'gui': '{}', 'cterm': '{:02}'}},\n".format(gui_color.css_hex, cterm_color) - ) - output.write("\\ ]\n") - - namespace = "terminal_color_" - output.write("let {}background = '{}'\n".format(namespace, theme.bg.css_hex)) - output.write("let {}foreground = '{}'\n".format(namespace, theme.fg.css_hex)) - for index, color in enumerate(theme.ansi_colors[:16]): - output.write("let {}{} = '{}'\n".format(namespace, index, color.css_hex)) - - -class ThemeGeneratorSetvtrgb(ThemeGenerator): - # default setvtrgb config: - # 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 - # 0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 - # 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 - - def file_name(self) -> str: - return "setvtrgb.txt" - - def generate(self, theme: Theme, output: TextIO) -> None: - for i in range(3): - output.write(",".join(str(color[i]) for color in theme.ansi_colors[:16])) - output.write("\n") - - -class ThemeGeneratorXfceTerminal(ThemeGenerator): - - def file_name(self) -> str: - return "xfce4-terminal.theme" - - def generate(self, theme: Theme, output: TextIO) -> None: - output.write("[Scheme]\n") - output.write("Name=dmitmel's dotfiles colorscheme\n") - output.write("ColorForeground={}\n".format(theme.fg.css_hex)) - output.write("ColorBackground={}\n".format(theme.bg.css_hex)) - output.write("ColorCursorUseDefault=FALSE\n") - output.write("ColorCursorForeground={}\n".format(theme.cursor_fg.css_hex)) - output.write("ColorCursor={}\n".format(theme.cursor_bg.css_hex)) - output.write("ColorSelectionUseDefault=FALSE\n") - output.write("ColorSelection={}\n".format(theme.selection_fg.css_hex)) - output.write("ColorSelectionBackground={}\n".format(theme.selection_bg.css_hex)) - output.write("TabActivityColor={}\n".format(theme.base16_colors[0x8].css_hex)) - output.write("ColorBoldUseDefault=TRUE\n") - output.write( - "ColorPalette={}\n".format(";".join(color.css_hex for color in theme.ansi_colors)) - ) - - -class ThemeGeneratorVscode(ThemeGenerator): - - def file_name(self) -> str: - return "vscode-colorCustomizations.json" - - def generate(self, theme: Theme, output: TextIO) -> None: - ANSI_COLOR_NAMES = [ - "Black", - "Red", - "Green", - "Yellow", - "Blue", - "Magenta", - "Cyan", - "White", - ] - - colors: Dict[str, str] = { - "terminal.background": theme.bg.css_hex, - "terminal.foreground": theme.fg.css_hex, - "terminal.selectionBackground": theme.selection_bg.css_hex, - "terminalCursor.background": theme.cursor_fg.css_hex, - "terminalCursor.foreground": theme.cursor_bg.css_hex, - } - - for is_bright in [False, True]: - for color_index, color_name in enumerate(ANSI_COLOR_NAMES): - color = theme.ansi_colors[color_index + int(is_bright) * len(ANSI_COLOR_NAMES)] - colors["terminal.ansi" + ("Bright" if is_bright else "") + color_name] = color.css_hex - - json.dump(colors, output, ensure_ascii=False, indent=2) - output.write("\n") - - -class ThemeGeneratorIterm(ThemeGenerator): - - def file_name(self) -> str: - return "iterm.itermcolors" - - def generate(self, theme: Theme, output: TextIO) -> None: - output.write('\n') - output.write( - '\n' - ) - output.write('\n') - output.write("\n") - - def write_color(key_name, color): - r, g, b = (float(component) / 0xff for component in color) - output.write(" {} Color\n".format(key_name)) - output.write(" \n") - output.write(" Color Space\n") - output.write(" sRGB\n") - output.write(" Red Component\n") - output.write(" {}\n".format(r)) - output.write(" Green Component\n") - output.write(" {}\n".format(g)) - output.write(" Blue Component\n") - output.write(" {}\n".format(b)) - output.write(" \n") - - write_color("Background", theme.bg) - write_color("Foreground", theme.fg) - write_color("Bold", theme.fg) - write_color("Cursor", theme.cursor_bg) - write_color("Cursor Text", theme.cursor_fg) - write_color("Selection Color", theme.selection_bg) - write_color("Selected Text Color", theme.selection_fg) - for index, color in enumerate(theme.ansi_colors[:16]): - write_color("Ansi " + str(index), color) - write_color("Link", theme.link_color) - - output.write("\n") - output.write("\n") - - -class ThemeGeneratorCssVariables(ThemeGenerator): - - def file_name(self) -> str: - return "variables.css" - - def generate(self, theme: Theme, output: TextIO) -> None: - output.write(":root {\n") - for var_name, color in theme.css_variables.items(): - output.write(" --dotfiles-colorscheme-{}: {};\n".format(var_name, color.css_hex)) - output.write("}\n") - - -class ThemeGeneratorScss(ThemeGenerator): - - def file_name(self) -> str: - return "_colorscheme.scss" - - def generate(self, theme: Theme, output: TextIO) -> None: - output.write("$is-dark: {};\n".format("true" if theme.is_dark else "false")) - for var_name, color in theme.css_variables.items(): - output.write("${}: {};\n".format(var_name, color.css_hex)) - output.write("$base: ({});\n".format(", ".join(c.css_hex for c in theme.base16_colors))) - output.write("$ansi: ({});\n".format(", ".join(c.css_hex for c in theme.ansi_colors))) - - -class ThemeGeneratorPrismJs(ThemeGenerator): - - def file_name(self) -> str: - return "prismjs-theme.css" - - def generate(self, theme: Theme, output: TextIO) -> None: - with open(os.path.join(__dir__, "prismjs-theme-src.css")) as src_file: - src_css = src_file.read() - for var_name, color in theme.css_variables.items(): - src_css = src_css.replace("var(--dotfiles-colorscheme-{})".format(var_name), color.css_hex) - output.write(src_css) - - -def main() -> None: - theme: Theme = MyTheme() - generators: List[ThemeGenerator] = [ - ThemeGeneratorKitty(), - ThemeGeneratorTermux(), - ThemeGeneratorZsh(), - ThemeGeneratorVim(), - ThemeGeneratorSetvtrgb(), - ThemeGeneratorXfceTerminal(), - ThemeGeneratorVscode(), - ThemeGeneratorIterm(), - ThemeGeneratorCssVariables(), - ThemeGeneratorScss(), - ThemeGeneratorPrismJs(), - ] - - out_dir = os.path.join(__dir__, "out") - os.makedirs(out_dir, exist_ok=True) - - for generator in generators: - with open(os.path.join(out_dir, generator.file_name()), "w") as output_file: - generator.generate(theme, output_file) - - -if __name__ == "__main__": - main() diff --git a/colorschemes/out/_colorscheme.scss b/colorschemes/out/colorscheme.scss similarity index 100% rename from colorschemes/out/_colorscheme.scss rename to colorschemes/out/colorscheme.scss diff --git a/colorschemes/out/prismjs-theme.css b/colorschemes/out/prismjs-theme.css index fd4b76e..010b18a 100644 --- a/colorschemes/out/prismjs-theme.css +++ b/colorschemes/out/prismjs-theme.css @@ -74,9 +74,7 @@ .token.unit, .token.attr-name, .token.color.hexcode, -.token.list, -.token.nil, -.token.nil.keyword { +.token.list { color: #f99157; } @@ -121,3 +119,4 @@ .token.rule { color: #cc99cc; } + diff --git a/colorschemes/prismjs-theme-src.css b/colorschemes/prismjs-theme-src.css index 7bdfd8b..50733e4 100644 --- a/colorschemes/prismjs-theme-src.css +++ b/colorschemes/prismjs-theme-src.css @@ -74,9 +74,7 @@ .token.unit, .token.attr-name, .token.color.hexcode, -.token.list, -.token.nil, -.token.nil.keyword { +.token.list { color: var(--dotfiles-colorscheme-base-09); } diff --git a/colorschemes/prismjs-theme.css.py b/colorschemes/prismjs-theme.css.py new file mode 100755 index 0000000..924f81d --- /dev/null +++ b/colorschemes/prismjs-theme.css.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import _theme as theme +import os + +with open(os.path.join(os.path.dirname(__file__), "prismjs-theme-src.css")) as f: + css_src = f.read() + +for var_name, color in theme.css_variables.items(): + css_src = css_src.replace("var(--{}{})".format(theme.css_variables_prefix, var_name), color) + +print(css_src) diff --git a/colorschemes/setvtrgb.txt.py b/colorschemes/setvtrgb.txt.py new file mode 100755 index 0000000..9dfb27f --- /dev/null +++ b/colorschemes/setvtrgb.txt.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import _theme as theme + +# default setvtrgb config: +# 0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 +# 0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 +# 0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 + +for i in range(3): + print(",".join([str(int(color[2 * i + 1:2 * i + 3], 16)) for color in theme.ansi_colors[:16]])) diff --git a/colorschemes/termux.properties.py b/colorschemes/termux.properties.py new file mode 100755 index 0000000..e6843ff --- /dev/null +++ b/colorschemes/termux.properties.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +def print_color(key_name, color): + print("{}={}".format(key_name, color)) + + +print_color("background", theme.bg) +print_color("foreground", theme.fg) +print_color("cursor", theme.cursor_bg) +for index, color in enumerate(theme.ansi_colors[:16]): + print_color("color" + str(index), color) diff --git a/colorschemes/variables.css.py b/colorschemes/variables.css.py new file mode 100755 index 0000000..2338a6f --- /dev/null +++ b/colorschemes/variables.css.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +print(":root {") +for var_name, color in theme.css_variables.items(): + print(" --{}{}: {};".format(theme.css_variables_prefix, var_name, color)) +print("}") diff --git a/colorschemes/vim.vim.py b/colorschemes/vim.vim.py new file mode 100755 index 0000000..38dfed0 --- /dev/null +++ b/colorschemes/vim.vim.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +print("let dotfiles_colorscheme_name = '{}'".format(theme.name)) +print("let dotfiles_colorscheme_base16_name = '{}'".format(theme.base16_name)) +print("let dotfiles_colorscheme_base16_colors = [") +gui_to_cterm_mapping = [0, 18, 19, 8, 20, 7, 21, 15, 1, 16, 3, 2, 6, 4, 5, 17] +for colors_pair in zip(theme.base16_colors[:16], gui_to_cterm_mapping): + print("\\ {{'gui': '{}', 'cterm': '{:>02}'}},".format(*colors_pair)) +print("\\ ]") + + +def print_terminal_color(key_name, color): + print("let terminal_color_{} = '{}'".format(key_name, color)) + + +print_terminal_color("background", theme.bg) +print_terminal_color("foreground", theme.fg) +for index, color in enumerate(theme.ansi_colors[:16]): + print_terminal_color(str(index), color) diff --git a/colorschemes/vscode-colorCustomizations.json.py b/colorschemes/vscode-colorCustomizations.json.py new file mode 100755 index 0000000..ed1b1dc --- /dev/null +++ b/colorschemes/vscode-colorCustomizations.json.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +import _theme as theme +import json + + +ANSI_COLOR_NAMES = [ + "Black", + "Red", + "Green", + "Yellow", + "Blue", + "Magenta", + "Cyan", + "White", +] + +colors = { + "terminal.background": theme.bg, + "terminal.foreground": theme.fg, + "terminal.selectionBackground": theme.selection_bg, + "terminalCursor.background": theme.cursor_fg, + "terminalCursor.foreground": theme.cursor_bg, +} + +for color_brightness in [False, True]: + for color_index, color_name in enumerate(ANSI_COLOR_NAMES): + color = theme.ansi_colors[color_index + int(color_brightness) * len(ANSI_COLOR_NAMES)] + colors["terminal.ansi" + ("Bright" if color_brightness else "") + color_name] = color + +print(json.dumps(colors, ensure_ascii=False, indent=2)) diff --git a/colorschemes/xfce4-terminal.theme.py b/colorschemes/xfce4-terminal.theme.py new file mode 100755 index 0000000..3b5f71e --- /dev/null +++ b/colorschemes/xfce4-terminal.theme.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +import _theme as theme + + +print("[Scheme]") +print("Name=dmitmel's dotfiles colorscheme") +print("ColorForeground={}".format(theme.fg)) +print("ColorBackground={}".format(theme.bg)) +print("ColorCursorUseDefault=FALSE") +print("ColorCursorForeground={}".format(theme.cursor_fg)) +print("ColorCursor={}".format(theme.cursor_bg)) +print("ColorSelectionUseDefault=FALSE") +print("ColorSelection={}".format(theme.selection_fg)) +print("ColorSelectionBackground={}".format(theme.selection_bg)) +print("TabActivityColor={}".format(theme.ansi_colors[1])) +print("ColorBoldUseDefault=TRUE") +print("ColorPalette={}".format(";".join(theme.ansi_colors))) diff --git a/colorschemes/zsh.zsh.py b/colorschemes/zsh.zsh.py new file mode 100755 index 0000000..5a32295 --- /dev/null +++ b/colorschemes/zsh.zsh.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import _theme as theme + +for attr in [ + "bg", + "fg", + "cursor_bg", + "cursor_fg", + "selection_bg", + "selection_fg", + "link_color", +]: + color = getattr(theme, attr) + print("colorscheme_{}={}".format(attr, color[1:])) +print("colorscheme_ansi_colors=(") +for color in theme.ansi_colors: + print(" {}".format(color[1:])) +print(")") diff --git a/script-resources/markdown2htmldoc/themes-out/my.css b/script-resources/markdown2htmldoc/themes-out/my.css index 3074f23..c6918ce 100644 --- a/script-resources/markdown2htmldoc/themes-out/my.css +++ b/script-resources/markdown2htmldoc/themes-out/my.css @@ -1 +1 @@ -/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#2d2d2d}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}table img{background-color:transparent}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} +/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}*{box-sizing:border-box}body{color:#d3d0c8;background-color:#2d2d2d;font-family:"Ubuntu",sans-serif;font-size:16px;line-height:1.5;word-wrap:break-word;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body::-moz-selection,body::selection,body ::-moz-selection,body ::selection{color:#d3d0c8;background-color:#515151}article{min-width:200px;max-width:960px;margin:0 auto;padding:32px}@media(max-width: 767px){article{padding:24px}}article::after,article::before{display:table;content:""}article::after{clear:both}article>:first-child{margin-top:0 !important}article>:last-child{margin-bottom:0 !important}.octicon{display:inline-block;overflow:visible !important;vertical-align:text-bottom;fill:currentColor}a{color:#69c;text-decoration:none}a:hover,a:focus,a:active{text-decoration:underline}a:not([href]){color:unset;text-decoration:none}hr{margin-top:1.5em;margin-bottom:1.5em;border:.2em solid #515151}hr::after,hr::before{display:table;content:""}hr::after{clear:both}dl,details,table,blockquote,ul,ol,pre,p{margin-top:1em;margin-bottom:1em}blockquote{margin-left:0;margin-right:0;padding-left:1em;border-left:.25em solid #515151}blockquote>:first-child{margin-top:0 !important}blockquote>:last-child{margin-bottom:0 !important}summary{cursor:pointer}img{max-width:100%;box-sizing:content-box;background-color:#393939}img[align=left],img[align=right]{margin:.5em 1.25em}img[align=left]{margin-left:0}img[align=right]{margin-right:0}ins,del{text-decoration:none}ins{color:#9c9}del{color:#f2777a}mark{background-color:#fc6;color:#2d2d2d}h1,h2,h3,h4,h5,h6{margin-top:1.5em;margin-bottom:1em;padding-bottom:.3em;border-bottom:1px solid #515151;font-weight:600;line-height:1.25}h1 .anchor,h2 .anchor,h3 .anchor,h4 .anchor,h5 .anchor,h6 .anchor{float:left;padding-right:4px;margin-left:-20px;color:unset}h1 .anchor:hover,h2 .anchor:hover,h3 .anchor:hover,h4 .anchor:hover,h5 .anchor:hover,h6 .anchor:hover{text-decoration:none}h1 .anchor:focus,h2 .anchor:focus,h3 .anchor:focus,h4 .anchor:focus,h5 .anchor:focus,h6 .anchor:focus{outline:none}h1 .anchor>*,h2 .anchor>*,h3 .anchor>*,h4 .anchor>*,h5 .anchor>*,h6 .anchor>*{visibility:hidden;vertical-align:middle}h1:hover .anchor>*,h2:hover .anchor>*,h3:hover .anchor>*,h4:hover .anchor>*,h5:hover .anchor>*,h6:hover .anchor>*{visibility:visible}h1{font-size:2em}h2{font-size:1.5em}h3{font-size:1.25em}h4{font-size:1em}h5{font-size:.875em}h6{font-size:.85em}code,kbd,samp,pre{font-family:"Ubuntu Mono",monospace}code{padding:.2em .3em;background-color:rgba(116,115,105,.2);border-radius:4px}pre{padding:1em;overflow:auto;color:#d3d0c8;background-color:#2d2d2d;border:1px solid #515151;border-radius:4px;line-height:1.3;word-wrap:normal}pre code{padding:unset;background-color:unset;border:unset}kbd{display:inline-block;padding:.2em .3em;vertical-align:bottom;font:0.75em/0.8333333333 Ubuntu Mono, monospace;color:#d3d0c8;background-color:#1a1a1a;border:.1em solid #0d0d0d;border-bottom-width:.4em;border-radius:4px}table{display:block;width:100%;overflow:auto;border-spacing:0;border-collapse:collapse;width:max-content;max-width:100%}th{font-weight:600}td,th{padding:.4em .75em;border:1px solid #515151}tr:nth-child(2n){background-color:rgba(81,81,81,.1)}ol,ul{padding-left:2em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}li{margin-top:.25em;margin-bottom:.25em}dt{margin-top:1em;font-weight:600;font-style:italic}dd{margin-bottom:1em;margin-left:0;padding-left:1em}ul>li.task-list-item{list-style-type:none}ul>li.task-list-item input[type=checkbox]:first-child{margin:0 .2em .25em -1.6em;vertical-align:middle} diff --git a/script-resources/markdown2htmldoc/themes-src/my.scss b/script-resources/markdown2htmldoc/themes-src/my.scss index c51c7ce..96fb6b6 100644 --- a/script-resources/markdown2htmldoc/themes-src/my.scss +++ b/script-resources/markdown2htmldoc/themes-src/my.scss @@ -21,7 +21,7 @@ // @use '../node_modules/normalize.css/normalize.css'; -@use '../../../colorschemes/out/_colorscheme.scss'; +@use '../../../colorschemes/out/colorscheme.scss'; //////////////////////////////////////////////////////////////////////////////// // CONFIGURATION CONSTANTS AND FUNCTIONS @@ -188,7 +188,7 @@ img { max-width: 100%; // Fixes manually specified widths for images. box-sizing: content-box; - background-color: colorscheme.$bg; + background-color: colorscheme.$base-01; &[align='left'], &[align='right'] { @@ -383,11 +383,6 @@ table { // rules does differently from just `width: 100%`. width: max-content; max-width: 100%; - - // - img { - background-color: transparent; - } } th {