Merge commit '42ee2309f7a8bfe92d8f4f569a9eaae981d6dd1c' as 'zsh/.zsh/tty-solarized'

This commit is contained in:
Gabe Venberg 2018-08-06 17:43:12 -05:00
commit 2f5e0fbc54
4 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,15 @@
# Solarized color theme for the linux TTY
A tty solarized theme using Ethan Schoonovers [Solarized color theme](http://ethanschoonover.com/solarized).
If you are looking for colors on your xterm, konsole, terminator, urxvt, guake, aterm and friends, please search a bit more. This script is for setting the colors on a linux TTY, the real terminal that you get if you are not running ``X`` or ``wayland``.
## Repositories
* This theme as a single repository: [tty-solarized](https://github.com/joepvd/tty-solarized)
* The main solarized repository: [solarized](https://github.com/altercation/solarized)
## Installation
Source either ``tty-solarized-dark.sh`` or ``tty-solarized-light.sh`` in the startup file of your shell. As this is only run on TTYs where usually a login shell is started, the login file of your shell (``${ZDOTDIR:-$HOME}/.zlogin`` for zsh or ``~/.profile`` for bash). Now the 'normal' names for colors are available to your applications.
Included is also the awk-script used to generate those two files. Would the color scheme be changed upstream, anyone with gawk installed can update these files.

View file

@ -0,0 +1,44 @@
#!/usr/bin/gawk -f
# pty2tty.awk: Create solarized color scheme for TTY.
# Usage: ./pty2tty.awk [-v t=light|dark] $Xresources
# With $Xresources from http://github.com/altercation.
# Put resulting code in your shell's startup/login file.
# By Joep van Delft, 2013
BEGIN {
if (t~/^[lL]+/) theme="light"
else theme="dark"
}
/! (Common|Dark|Light) *$/ {
flag=tolower($2)
next
}
/^(! |)#define/ {
if (flag=="common" || flag==theme) {
solar[$(NF-1)]["var"] = gensub(/[^[:xdigit:]]/,"","g",$NF)
}
next
}
/^\*color/ {
solar[$2]["code"] = gensub(/[^[:digit:]]+/,"","g",$1)
next
}
END{
print "# Solarized theme for tty, the", theme, "version."
print "# Based on:"
print "# - Solarized (http://ethanschoonover.com/solarized)"
print "# - Xresources from http://github.com/altercation/solarized"
print "# Generated with pty2tty.awk by Joep van Delft"
print "# http://github.com/joepvd/tty-solarized"
print "if [ \"$TERM\" = \"linux\" ]; then"
for (desc in solar)
printf " echo -en \"\\e]P%X%s\" # %s\n", \
solar[desc]["code"], \
solar[desc]["var"], \
desc
print " clear # against bg artifacts\nfi"
}

View file

@ -0,0 +1,25 @@
# Solarized theme for tty, the dark version.
# Based on:
# - Solarized (http://ethanschoonover.com/solarized)
# - Xresources from http://github.com/altercation/solarized
# Generated with pty2tty.awk by Joep van Delft
# http://github.com/joepvd/tty-solarized
if [ "$TERM" = "linux" ]; then
echo -en "\e]PB657b83" # S_base00
echo -en "\e]PA586e75" # S_base01
echo -en "\e]P0073642" # S_base02
echo -en "\e]P62aa198" # S_cyan
echo -en "\e]P8002b36" # S_base03
echo -en "\e]P2859900" # S_green
echo -en "\e]P5d33682" # S_magenta
echo -en "\e]P1dc322f" # S_red
echo -en "\e]PC839496" # S_base0
echo -en "\e]PE93a1a1" # S_base1
echo -en "\e]P9cb4b16" # S_orange
echo -en "\e]P7eee8d5" # S_base2
echo -en "\e]P4268bd2" # S_blue
echo -en "\e]P3b58900" # S_yellow
echo -en "\e]PFfdf6e3" # S_base3
echo -en "\e]PD6c71c4" # S_violet
clear # against bg artifacts
fi

View file

@ -0,0 +1,25 @@
# Solarized theme for tty, the light version.
# Based on:
# - Solarized (http://ethanschoonover.com/solarized)
# - Xresources from http://github.com/altercation/solarized
# Generated with pty2tty.awk by Joep van Delft
# http://github.com/joepvd/tty-solarized
if [ "$TERM" = "linux" ]; then
echo -en "\e]PB839496" # S_base00
echo -en "\e]PA93a1a1" # S_base01
echo -en "\e]P0eee8d5" # S_base02
echo -en "\e]P62aa198" # S_cyan
echo -en "\e]P8fdf6e3" # S_base03
echo -en "\e]P2859900" # S_green
echo -en "\e]P5d33682" # S_magenta
echo -en "\e]P1dc322f" # S_red
echo -en "\e]PC657b83" # S_base0
echo -en "\e]PE586e75" # S_base1
echo -en "\e]P9cb4b16" # S_orange
echo -en "\e]P7073642" # S_base2
echo -en "\e]P4268bd2" # S_blue
echo -en "\e]P3b58900" # S_yellow
echo -en "\e]PF002b36" # S_base3
echo -en "\e]PD6c71c4" # S_violet
clear # against bg artifacts
fi