Package: cmtg
cmtgcmtg(Color Matching Theme Generator) is a command line utility for generating matching color themes from templates.
It works by assigning colors from given palette(s) based on theircolor difference.
It replaces colors of the form#RRGGBBin-place in the output.InstallInstall from PyPI:pip3 install cmtgUsageusage: cmtg [-h] [--dist [{index,euclidean,redmean,cie1976,cie1994,cie2000,cmc}]] template palettes [palettes ...] out

Generate matching color theme given a template and palette

positional arguments:
  template              stdin, file, or builtins: ['simple.sublime-color-scheme', 'xterm.Xresources', 'pal.sh', 'pal.bash']
  palettes              stdin, file, xres, appres, or builtins: ['vga.clr', 'vscode.clr', 'ubuntu.clr', 'putty.clr', 'mirc.clr', 'powershell6.clr', 'eclipse.clr',
                        'xterm.clr', 'win10.clr', 'macos.clr', 'flat.clr', 'winxp.clr']
  out                   stdout or file

optional arguments:
  -h, --help            show this help message and exit
  --dist [{index,euclidean,redmean,cie1976,cie1994,cie2000,cmc}]
                        the color distance method (default: cie2000)Builtinsxresgrabs colors from~/.Xresourcesprocessed withcppwithCMTGmacro definedappresgrabs colors fromappres cmtgoutput (which uses the currently loaded Xresources from xrdb)simple.sublime-color-scheme: My own Sublime Text color scheme loosely based on themicroeditor'ssimpleschemexterm.Xresources: A typical set of colorspal.bash/sh: Scripts you can throw in a.bashrcthat set the palette used in theLinux consoleThe default palette used in a Linux console (devoid of X) isvga.clrNote that unlike xterm, separate foreground and background colors may not be used, you can only choose them from the 16 color palettevga/winxp/powershell6/vscode/win10/macos/putty/mirc/xterm/ubuntu/eclipse.clr: ANSI 16 color palettes used in popular terminalsANSI colors consist of Black, Red, Green, Yellow, Blue, Magenta, Cyan, White and "bright" versions of eachflat.clr: My own ANSI 16 color palette with low contrastindex"color distance method" replaces colors in order of appearance rather than fancy algorithmsExamplescmtg pal.bash xres - >>~/.bashrc
cmtg simple.sublime-color-scheme flat.clr ~/.config/sublime-text-3/Packages/User/simple-flat.sublime-color-scheme
cmtg xterm.Xresources flat.clr ~/.Xresources
cmtg --dist index xterm.Xresources vscode.clr ~/.Xresources

cmtg vga.clr winxp.clr flat.clr /dev/null
cmtg vga.clr winxp.clr - | cmtg - flat.clr /dev/null

appres | cmtg pal.bash - >>~/.bashrc
appres | grep --color=never "color[0-9]" | sort -V | cmtg --dist index - vscode.clr -TipsWhen experimenting to get the right color assignment, use/dev/nulloutput so it just prints the assignments to stderr.Try experimenting with different distance methods for different resultsTry chaining together palettes to work as intermediariesMultiple palettes can be passed, or the results may be piped(|) through stdin/stdout if you need different distance methods in useThewinxp.clrpalette is especially useful for ANSI colors, as its the most strictly mathematically definedThe builtin templates all use thewinxp.clrpallete for this reason, they migrate to any other ANSI palette in one stepANSI andbase16palettes are defined differently, despite both consisting of 16 colorsWhile this utility is very generic and can be used in many contexts, the major focus is on ANSI colorsSupport forbase16colors and templates is a planned feature