├── .gitignore ├── .travis.yml ├── templates_for_test ├── test1.solution ├── test1.template ├── test2.solution └── test2.template ├── themes ├── nord.yaml ├── summer.yaml ├── mocha.yaml ├── ocean.yaml ├── cupcake.yaml ├── eighties.yaml ├── default-dark.yaml └── default-light.yaml ├── templates ├── color-palette.sh ├── colors.json ├── zathurarc ├── colors.Xresources └── tty.sh ├── completion └── bash │ └── just-colors ├── Makefile ├── README.md ├── LICENSE.md ├── tests └── just-colors /.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | templates_for_test/*.cache 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | 3 | script: 4 | - bash tests 5 | -------------------------------------------------------------------------------- /templates_for_test/test1.solution: -------------------------------------------------------------------------------- 1 | This is simple template for test 2 | 3 | test all colors in hex: 181818 282828 383838 4 | 585858 b8b8b8 d8d8d8 e8e8e8 f8f8f8 5 | ab4642 dc9656 f7ca88 a1b56c 86c1b9 6 | 7cafc2 ba8baf a16946 7 | -------------------------------------------------------------------------------- /templates_for_test/test1.template: -------------------------------------------------------------------------------- 1 | This is simple template for test 2 | 3 | test all colors in hex: {{base00-hex}} {{base01-hex}} {{base02-hex}} 4 | {{base03-hex}} {{base04-hex}} {{base05-hex}} {{base06-hex}} {{base07-hex}} 5 | {{base08-hex}} {{base09-hex}} {{base0A-hex}} {{base0B-hex}} {{base0C-hex}} 6 | {{base0D-hex}} {{base0E-hex}} {{base0F-hex}} 7 | -------------------------------------------------------------------------------- /templates_for_test/test2.solution: -------------------------------------------------------------------------------- 1 | color00="18/18/18" # Base 00 - Black 2 | color01="ab/46/42" # Base 08 - Red 3 | color02="a1/b5/6c" # Base 0B - Green 4 | color03="f7/ca/88" # Base 0A - Yellow 5 | color04="7c/af/c2" # Base 0D - Blue 6 | color05="ba/8b/af" # Base 0E - Magenta 7 | color06="86/c1/b9" # Base 0C - Cyan 8 | color07="d8/d8/d8" # Base 05 - White 9 | color08="58/58/58" # Base 03 - Bright Black 10 | -------------------------------------------------------------------------------- /themes/nord.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Nord" 2 | author: "arcticicestudio" 3 | base00: "2e3440" 4 | base01: "3b4252" 5 | base02: "434c5e" 6 | base03: "4c566a" 7 | base04: "d8dee9" 8 | base05: "e5e9f0" 9 | base06: "eceff4" 10 | base07: "8fbcbb" 11 | base08: "bf616a" 12 | base09: "d08770" 13 | base0A: "ebcb8b" 14 | base0B: "a3be8c" 15 | base0C: "88c0d0" 16 | base0D: "81a1c1" 17 | base0E: "b48ead" 18 | base0F: "5e81ac" 19 | -------------------------------------------------------------------------------- /themes/summer.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Summer" 2 | author: "Andrey Varfolomeev" 3 | base00: "051314" 4 | base01: "1d2a2b" 5 | base02: "364242" 6 | base03: "50595a" 7 | base04: "bdb5b5" 8 | base05: "c5bdbd" 9 | base06: "e7dddd" 10 | base07: "ffffff" 11 | base08: "e74a4b" 12 | base09: "f6ac2b" 13 | base0A: "f2ae5f" 14 | base0B: "c0da98" 15 | base0C: "77bb8b" 16 | base0D: "329434" 17 | base0E: "e12934" 18 | base0F: "f48382" 19 | -------------------------------------------------------------------------------- /themes/mocha.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Mocha" 2 | author: "Chris Kempson (http://chriskempson.com)" 3 | base00: "3B3228" 4 | base01: "534636" 5 | base02: "645240" 6 | base03: "7e705a" 7 | base04: "b8afad" 8 | base05: "d0c8c6" 9 | base06: "e9e1dd" 10 | base07: "f5eeeb" 11 | base08: "cb6077" 12 | base09: "d28b71" 13 | base0A: "f4bc87" 14 | base0B: "beb55b" 15 | base0C: "7bbda4" 16 | base0D: "8ab3b5" 17 | base0E: "a89bb9" 18 | base0F: "bb9584" -------------------------------------------------------------------------------- /themes/ocean.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Ocean" 2 | author: "Chris Kempson (http://chriskempson.com)" 3 | base00: "2b303b" 4 | base01: "343d46" 5 | base02: "4f5b66" 6 | base03: "65737e" 7 | base04: "a7adba" 8 | base05: "c0c5ce" 9 | base06: "dfe1e8" 10 | base07: "eff1f5" 11 | base08: "bf616a" 12 | base09: "d08770" 13 | base0A: "ebcb8b" 14 | base0B: "a3be8c" 15 | base0C: "96b5b4" 16 | base0D: "8fa1b3" 17 | base0E: "b48ead" 18 | base0F: "ab7967" -------------------------------------------------------------------------------- /themes/cupcake.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Cupcake" 2 | author: "Chris Kempson (http://chriskempson.com)" 3 | base00: "fbf1f2" 4 | base01: "f2f1f4" 5 | base02: "d8d5dd" 6 | base03: "bfb9c6" 7 | base04: "a59daf" 8 | base05: "8b8198" 9 | base06: "72677E" 10 | base07: "585062" 11 | base08: "D57E85" 12 | base09: "EBB790" 13 | base0A: "DCB16C" 14 | base0B: "A3B367" 15 | base0C: "69A9A7" 16 | base0D: "7297B9" 17 | base0E: "BB99B4" 18 | base0F: "BAA58C" -------------------------------------------------------------------------------- /themes/eighties.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Eighties" 2 | author: "Chris Kempson (http://chriskempson.com)" 3 | base00: "2d2d2d" 4 | base01: "393939" 5 | base02: "515151" 6 | base03: "747369" 7 | base04: "a09f93" 8 | base05: "d3d0c8" 9 | base06: "e8e6df" 10 | base07: "f2f0ec" 11 | base08: "f2777a" 12 | base09: "f99157" 13 | base0A: "ffcc66" 14 | base0B: "99cc99" 15 | base0C: "66cccc" 16 | base0D: "6699cc" 17 | base0E: "cc99cc" 18 | base0F: "d27b53" -------------------------------------------------------------------------------- /themes/default-dark.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Default Dark" 2 | author: "Chris Kempson (http://chriskempson.com)" 3 | base00: "181818" 4 | base01: "282828" 5 | base02: "383838" 6 | base03: "585858" 7 | base04: "b8b8b8" 8 | base05: "d8d8d8" 9 | base06: "e8e8e8" 10 | base07: "f8f8f8" 11 | base08: "ab4642" 12 | base09: "dc9656" 13 | base0A: "f7ca88" 14 | base0B: "a1b56c" 15 | base0C: "86c1b9" 16 | base0D: "7cafc2" 17 | base0E: "ba8baf" 18 | base0F: "a16946" 19 | -------------------------------------------------------------------------------- /themes/default-light.yaml: -------------------------------------------------------------------------------- 1 | scheme: "Default Light" 2 | author: "Chris Kempson (http://chriskempson.com)" 3 | base00: "f8f8f8" 4 | base01: "e8e8e8" 5 | base02: "d8d8d8" 6 | base03: "b8b8b8" 7 | base04: "585858" 8 | base05: "383838" 9 | base06: "282828" 10 | base07: "181818" 11 | base08: "ab4642" 12 | base09: "dc9656" 13 | base0A: "f7ca88" 14 | base0B: "a1b56c" 15 | base0C: "86c1b9" 16 | base0D: "7cafc2" 17 | base0E: "ba8baf" 18 | base0F: "a16946" 19 | -------------------------------------------------------------------------------- /templates/color-palette.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | base00={{base00-hex}} 4 | base01={{base01-hex}} 5 | base02={{base02-hex}} 6 | base03={{base03-hex}} 7 | base04={{base04-hex}} 8 | base05={{base05-hex}} 9 | base06={{base06-hex}} 10 | base07={{base07-hex}} 11 | base08={{base08-hex}} 12 | base09={{base09-hex}} 13 | base0A={{base0A-hex}} 14 | base0B={{base0B-hex}} 15 | base0C={{base0C-hex}} 16 | base0D={{base0D-hex}} 17 | base0E={{base0E-hex}} 18 | base0F={{base0F-hex}} 19 | -------------------------------------------------------------------------------- /templates/colors.json: -------------------------------------------------------------------------------- 1 | { 2 | "base00": "{{base00-hex}}", 3 | "base01": "{{base01-hex}}", 4 | "base02": "{{base02-hex}}", 5 | "base03": "{{base03-hex}}", 6 | "base04": "{{base04-hex}}", 7 | "base05": "{{base05-hex}}", 8 | "base06": "{{base06-hex}}", 9 | "base07": "{{base07-hex}}", 10 | "base08": "{{base08-hex}}", 11 | "base09": "{{base09-hex}}", 12 | "base0A": "{{base0A-hex}}", 13 | "base0B": "{{base0B-hex}}", 14 | "base0C": "{{base0C-hex}}", 15 | "base0D": "{{base0D-hex}}", 16 | "base0E": "{{base0E-hex}}", 17 | "base0F": "{{base0F-hex}}" 18 | } 19 | -------------------------------------------------------------------------------- /completion/bash/just-colors: -------------------------------------------------------------------------------- 1 | _just_colors() 2 | { 3 | local cur prev words cword split 4 | _init_completion -s || return 5 | 6 | case "$prev" in 7 | --theme|-!(-*)T) 8 | local conf_path=~/.config/just-colors/themes 9 | local themes=$(ls $conf_path | sed "s/\.yaml//g") 10 | COMPREPLY+=( $(compgen -W "$themes" -- "$cur") ) 11 | return 12 | ;; 13 | esac 14 | 15 | $split && return 16 | 17 | if [[ "$cur" == * ]]; then 18 | COMPREPLY=( $(compgen -W '$(_parse_help "$1" --help)' -- "$cur") ) 19 | [[ $COMPREPLY == *= ]] && compopt -o nospace 20 | [[ $COMPREPLY ]] && return 21 | fi 22 | } && 23 | complete -F _just_colors just-colors 24 | 25 | # ex: filetype=sh 26 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | BASH_COMPLETION_PATH=/usr/share/bash-completion/completions 2 | path := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) 3 | 4 | PATH_TO_FILE=/bin/just-colors 5 | 6 | all: 7 | @echo run \'make install\' to install just-colors 8 | 9 | install: uninstall 10 | @chmod +x $(path)/just-colors 11 | @ln -s $(path)/just-colors /bin/just-colors 12 | 13 | @echo "[OK] Just-Colors is installed" 14 | 15 | ifneq ("$(wildcard $(BASH_COMPLETION_PATH))","") 16 | @ln -s $(path)/completion/bash/just-colors $(BASH_COMPLETION_PATH)/just-colors 17 | @echo "[OK] Bash completion for just-colors is installed" 18 | endif 19 | 20 | test: 21 | @./tests 22 | 23 | uninstall: 24 | @rm -f /bin/just-colors 25 | @rm -f $(BASH_COMPLETION_PATH)/just-colors 26 | -------------------------------------------------------------------------------- /templates_for_test/test2.template: -------------------------------------------------------------------------------- 1 | color00="{{base00-hex-r}}/{{base00-hex-g}}/{{base00-hex-b}}" # Base 00 - Black 2 | color01="{{base08-hex-r}}/{{base08-hex-g}}/{{base08-hex-b}}" # Base 08 - Red 3 | color02="{{base0B-hex-r}}/{{base0B-hex-g}}/{{base0B-hex-b}}" # Base 0B - Green 4 | color03="{{base0A-hex-r}}/{{base0A-hex-g}}/{{base0A-hex-b}}" # Base 0A - Yellow 5 | color04="{{base0D-hex-r}}/{{base0D-hex-g}}/{{base0D-hex-b}}" # Base 0D - Blue 6 | color05="{{base0E-hex-r}}/{{base0E-hex-g}}/{{base0E-hex-b}}" # Base 0E - Magenta 7 | color06="{{base0C-hex-r}}/{{base0C-hex-g}}/{{base0C-hex-b}}" # Base 0C - Cyan 8 | color07="{{base05-hex-r}}/{{base05-hex-g}}/{{base05-hex-b}}" # Base 05 - White 9 | color08="{{base03-hex-r}}/{{base03-hex-g}}/{{base03-hex-b}}" # Base 03 - Bright Black 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Just-Colors 2 | =========== 3 | 4 | [![made-with-bash](https://img.shields.io/badge/Made%20with-Bash-1f425f.svg)](https://www.gnu.org/software/bash/) 5 | 6 | [![Build Status](https://travis-ci.com/andreyvpng/just-colors.svg?branch=master)](https://travis-ci.com/andreyvpng/just-colors) 7 | 8 | Just Colors is easy and flexible way to create themes for all programms using built-in or custom color scheme. [See wiki for details](https://github.com/andreyvpng/just-colors/wiki/Usage) 9 | 10 | # Features 11 | 12 | - Easy installing and usage 13 | - Easy for create custom templates and colorscheme 14 | - Comptibale templates and colorscheme with [base16](https://github.com/chriskempson/base16) 15 | 16 | # Installing 17 | 18 | ```bash 19 | git clone https://github.com/andreyvpng/just-colors \ 20 | ~/.config/just-colors/ 21 | 22 | cd ~/.config/just-colors 23 | 24 | make install 25 | ``` 26 | 27 | # License 28 | 29 | Copyright (c) Andrey Varfolomeev. Licensed under the [MIT license](LICENSE.md) 30 | -------------------------------------------------------------------------------- /templates/zathurarc: -------------------------------------------------------------------------------- 1 | set recolor "true" 2 | set completion-bg "#{{base00-hex}}" 3 | set completion-fg "#{{base05-hex}}" 4 | set completion-group-bg "#{{base00-hex}}" 5 | set completion-group-fg "#{{base0B-hex}}" 6 | set completion-highlight-bg "#{{base0B-hex}}" 7 | set completion-highlight-fg "#{{base00-hex}}" 8 | set recolor-lightcolor "#{{base00-hex}}" 9 | set recolor-darkcolor "#{{base05-hex}}" 10 | set default-bg "#{{base00-hex}}" 11 | set inputbar-bg "#{{base00-hex}}" 12 | set inputbar-fg "#{{base05-hex}}" 13 | set notification-bg "#{{base00-hex}}" 14 | set notification-fg "#{{base05-hex}}" 15 | set notification-error-bg "#{{base08-hex}}" 16 | set notification-error-fg "#{{base05-hex}}" 17 | set notification-warning-bg "#{{base08-hex}}" 18 | set notification-warning-fg "#{{base05-hex}}" 19 | set statusbar-bg "#{{base01-hex}}" 20 | set statusbar-fg "#{{base05-hex}}" 21 | set index-bg "#{{base00-hex}}" 22 | set index-fg "#{{base05-hex}}" 23 | set index-active-bg "#{{base05-hex}}" 24 | set index-active-fg "#{{base00-hex}}" 25 | set render-loading-bg "#{{base00-hex}}" 26 | set render-loading-fg "#{{base05-hex}}" 27 | set window-title-home-tilde true 28 | set statusbar-basename true 29 | set selection-clipboard clipboard 30 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Just Colors is released under the MIT License: 2 | 3 | > Copyright (C) 2012 Andrey Varfolomeev 4 | > 5 | > Permission is hereby granted, free of charge, to any person obtaining 6 | > a copy of this software and associated documentation files (the 7 | > "Software"), to deal in the Software without restriction, including 8 | > without limitation the rights to use, copy, modify, merge, publish, 9 | > distribute, sublicense, and/or sell copies of the Software, and to 10 | > permit persons to whom the Software is furnished to do so, subject to 11 | > the following conditions: 12 | > 13 | > The above copyright notice and this permission notice shall be 14 | > included in all copies or substantial portions of the Software. 15 | > 16 | > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /templates/colors.Xresources: -------------------------------------------------------------------------------- 1 | #define base00 #{{base00-hex}} 2 | #define base01 #{{base01-hex}} 3 | #define base02 #{{base02-hex}} 4 | #define base03 #{{base03-hex}} 5 | #define base04 #{{base04-hex}} 6 | #define base05 #{{base05-hex}} 7 | #define base06 #{{base06-hex}} 8 | #define base07 #{{base07-hex}} 9 | #define base08 #{{base08-hex}} 10 | #define base09 #{{base09-hex}} 11 | #define base0A #{{base0A-hex}} 12 | #define base0B #{{base0B-hex}} 13 | #define base0C #{{base0C-hex}} 14 | #define base0D #{{base0D-hex}} 15 | #define base0E #{{base0E-hex}} 16 | #define base0F #{{base0F-hex}} 17 | 18 | *foreground: base05 19 | *background: base00 20 | *.foreground: base05 21 | *.background: base00 22 | URxvt*foreground: base05 23 | URxvt*background: base00 24 | URxvt*cursorColor: base05 25 | URxvt*borderColor: base00 26 | 27 | *color0: base00 28 | *color1: base08 29 | *color2: base0B 30 | *color3: base0A 31 | *color4: base0D 32 | *color5: base0E 33 | *color6: base0C 34 | *color7: base05 35 | 36 | *color8: base03 37 | *color9: base08 38 | *color10: base0B 39 | *color11: base0A 40 | *color12: base0D 41 | *color13: base0E 42 | *color14: base0C 43 | *color15: base07 44 | -------------------------------------------------------------------------------- /tests: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source ./just-colors > /dev/null 4 | 5 | PATH_PREFIX="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" 6 | CACHE_PATH=$PATH_PREFIX/cache 7 | TEMPLATE_PATH=$PATH_PREFIX/templates 8 | THEMES_PATH=$PATH_PREFIX/themes 9 | 10 | TOTAL_TESTS=0 11 | PASSED_TESTS=0 12 | PATH_TEMPLATES_FOR_TEST=$PATH_PREFIX/templates_for_test 13 | 14 | assert() { 15 | TOTAL_TESTS=`expr $TOTAL_TESTS + 1` 16 | arg_1=$1 17 | arg_2=$2 18 | message=$3 19 | case $# in 20 | 3) 21 | if [[ $arg_1 == $arg_2 ]]; then 22 | print_log ok $message 23 | PASSED_TESTS=`expr $PASSED_TESTS + 1` 24 | else 25 | print_log error "$arg_1 and $arg_2 is not equal" 26 | fi;; 27 | esac 28 | } 29 | 30 | clean_up() { 31 | local files_for_del=$(ls $PATH_TEMPLATES_FOR_TEST/*.cache) 32 | [[ "$files_for_del" ]] && rm $files_for_del 33 | } 34 | 35 | base00="181818" 36 | base01="282828" 37 | base02="383838" 38 | base03="585858" 39 | base04="b8b8b8" 40 | base05="d8d8d8" 41 | base06="e8e8e8" 42 | base07="f8f8f8" 43 | base08="ab4642" 44 | base09="dc9656" 45 | base0A="f7ca88" 46 | base0B="a1b56c" 47 | base0C="86c1b9" 48 | base0D="7cafc2" 49 | base0E="ba8baf" 50 | base0F="a16946" 51 | 52 | test_parse_theme_get_value() { 53 | parse_theme $THEMES_PATH/default-dark.$THEME_EXT 54 | for number in $(echo {0..9} {A..F}); do 55 | name_of_var="base0${number}" 56 | get_value ${name_of_var} 57 | assert "$RETURN_GET_VALUE" "${!name_of_var}" "$name_of_var" 58 | done 59 | } 60 | 61 | test_build_template() { 62 | for template in $(ls $PATH_TEMPLATES_FOR_TEST/*.template); do 63 | solution=${template%.template}.solution 64 | cache=${template%.template}.cache 65 | build_template $template $cache 66 | assert "$(diff $solution $cache)" "" "$template" 67 | done 68 | } 69 | 70 | test_all() { 71 | echo "test parse_theme and get_value" 72 | test_parse_theme_get_value 73 | echo "test build_template" 74 | test_build_template 75 | } 76 | 77 | test_all 78 | clean_up 79 | 80 | echo Total tests: $TOTAL_TESTS 81 | echo Passed tests: $PASSED_TESTS 82 | 83 | if [[ $TOTAL_TESTS == $PASSED_TESTS ]]; then 84 | exit 0 85 | fi 86 | exit 1 87 | -------------------------------------------------------------------------------- /templates/tty.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # based base16-shell (https://github.com/chriskempson/base16-shell) 4 | 5 | color00="{{base00-hex-r}}/{{base00-hex-g}}/{{base00-hex-b}}" # Base 00 - Black 6 | color01="{{base08-hex-r}}/{{base08-hex-g}}/{{base08-hex-b}}" # Base 08 - Red 7 | color02="{{base0B-hex-r}}/{{base0B-hex-g}}/{{base0B-hex-b}}" # Base 0B - Green 8 | color03="{{base0A-hex-r}}/{{base0A-hex-g}}/{{base0A-hex-b}}" # Base 0A - Yellow 9 | color04="{{base0D-hex-r}}/{{base0D-hex-g}}/{{base0D-hex-b}}" # Base 0D - Blue 10 | color05="{{base0E-hex-r}}/{{base0E-hex-g}}/{{base0E-hex-b}}" # Base 0E - Magenta 11 | color06="{{base0C-hex-r}}/{{base0C-hex-g}}/{{base0C-hex-b}}" # Base 0C - Cyan 12 | color07="{{base05-hex-r}}/{{base05-hex-g}}/{{base05-hex-b}}" # Base 05 - White 13 | color08="{{base03-hex-r}}/{{base03-hex-g}}/{{base03-hex-b}}" # Base 03 - Bright Black 14 | color09=$color01 # Base 08 - Bright Red 15 | color10=$color02 # Base 0B - Bright Green 16 | color11=$color03 # Base 0A - Bright Yellow 17 | color12=$color04 # Base 0D - Bright Blue 18 | color13=$color05 # Base 0E - Bright Magenta 19 | color14=$color06 # Base 0C - Bright Cyan 20 | color15="{{base07-hex-r}}/{{base07-hex-g}}/{{base07-hex-b}}" # Base 07 - Bright White 21 | color16="{{base09-hex-r}}/{{base09-hex-g}}/{{base09-hex-b}}" # Base 09 22 | color17="{{base0F-hex-r}}/{{base0F-hex-g}}/{{base0F-hex-b}}" # Base 0F 23 | color18="{{base01-hex-r}}/{{base01-hex-g}}/{{base01-hex-b}}" # Base 01 24 | color19="{{base02-hex-r}}/{{base02-hex-g}}/{{base02-hex-b}}" # Base 02 25 | color20="{{base04-hex-r}}/{{base04-hex-g}}/{{base04-hex-b}}" # Base 04 26 | color21="{{base06-hex-r}}/{{base06-hex-g}}/{{base06-hex-b}}" # Base 06 27 | color_foreground="{{base05-hex-r}}/{{base05-hex-g}}/{{base05-hex-b}}" # Base 05 28 | color_background="{{base00-hex-r}}/{{base00-hex-g}}/{{base00-hex-b}}" # Base 00 29 | 30 | if [ -n "$TMUX" ]; then 31 | # Tell tmux to pass the escape sequences through 32 | # (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) 33 | put_template() { printf '\033Ptmux;\033\033]4;%d;rgb:%s\033\033\\\033\\' $@; } 34 | put_template_var() { printf '\033Ptmux;\033\033]%d;rgb:%s\033\033\\\033\\' $@; } 35 | put_template_custom() { printf '\033Ptmux;\033\033]%s%s\033\033\\\033\\' $@; } 36 | elif [ "${TERM%%[-.]*}" = "screen" ]; then 37 | # GNU screen (screen, screen-256color, screen-256color-bce) 38 | put_template() { printf '\033P\033]4;%d;rgb:%s\007\033\\' $@; } 39 | put_template_var() { printf '\033P\033]%d;rgb:%s\007\033\\' $@; } 40 | put_template_custom() { printf '\033P\033]%s%s\007\033\\' $@; } 41 | elif [ "${TERM%%-*}" = "linux" ]; then 42 | put_template() { [ $1 -lt 16 ] && printf "\e]P%x%s" $1 $(echo $2 | sed 's/\///g'); } 43 | put_template_var() { true; } 44 | put_template_custom() { true; } 45 | else 46 | put_template() { printf '\033]4;%d;rgb:%s\033\\' $@; } 47 | put_template_var() { printf '\033]%d;rgb:%s\033\\' $@; } 48 | put_template_custom() { printf '\033]%s%s\033\\' $@; } 49 | fi 50 | 51 | # 16 color space 52 | put_template 0 $color00 53 | put_template 1 $color01 54 | put_template 2 $color02 55 | put_template 3 $color03 56 | put_template 4 $color04 57 | put_template 5 $color05 58 | put_template 6 $color06 59 | put_template 7 $color07 60 | put_template 8 $color08 61 | put_template 9 $color09 62 | put_template 10 $color10 63 | put_template 11 $color11 64 | put_template 12 $color12 65 | put_template 13 $color13 66 | put_template 14 $color14 67 | put_template 15 $color15 68 | 69 | # 256 color space 70 | put_template 16 $color16 71 | put_template 17 $color17 72 | put_template 18 $color18 73 | put_template 19 $color19 74 | put_template 20 $color20 75 | put_template 21 $color21 76 | 77 | # foreground / background / cursor color 78 | if [ -n "$ITERM_SESSION_ID" ]; then 79 | # iTerm2 proprietary escape codes 80 | put_template_custom Pg {{base05-hex}} # foreground 81 | put_template_custom Ph {{base00-hex}} # background 82 | put_template_custom Pi {{base05-hex}} # bold color 83 | put_template_custom Pj {{base02-hex}} # selection color 84 | put_template_custom Pk {{base05-hex}} # selected text color 85 | put_template_custom Pl {{base05-hex}} # cursor 86 | put_template_custom Pm {{base00-hex}} # cursor text 87 | else 88 | put_template_var 10 $color_foreground 89 | if [ "$BASE16_SHELL_SET_BACKGROUND" != false ]; then 90 | put_template_var 11 $color_background 91 | put_template_var 708 $color_background # internal border (rxvt) 92 | fi 93 | put_template_custom 12 ";7" # cursor (reverse video) 94 | fi 95 | 96 | # clean up 97 | unset -f put_template 98 | unset -f put_template_var 99 | unset -f put_template_custom 100 | unset color00 101 | unset color01 102 | unset color02 103 | unset color03 104 | unset color04 105 | unset color05 106 | unset color06 107 | unset color07 108 | unset color08 109 | unset color09 110 | unset color10 111 | unset color11 112 | unset color12 113 | unset color13 114 | unset color14 115 | unset color15 116 | unset color16 117 | unset color17 118 | unset color18 119 | unset color19 120 | unset color20 121 | unset color21 122 | unset color_foreground 123 | unset color_background 124 | -------------------------------------------------------------------------------- /just-colors: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o nounset 4 | set -o errexit 5 | 6 | PATH_PREFIX=$HOME/.config/just-colors 7 | CACHE_PATH=$PATH_PREFIX/cache 8 | TEMPLATE_PATH=$PATH_PREFIX/templates 9 | THEMES_PATH=$PATH_PREFIX/themes 10 | THEME_EXT=yaml 11 | VAR_PREFIX=TEMPLATE_VAR_ 12 | OK=0 13 | FAIL=1 14 | 15 | RED='\033[0;31m' 16 | GREEN='\033[0;32m' 17 | YELLOW='\033[0;33m' 18 | CYAN='\033[0;36m' 19 | NORMAL='\033[0m' 20 | 21 | THEME_PATH= 22 | DEBUG=$FAIL 23 | 24 | usage() { 25 | cat <