项目作者: sbakker

项目描述 :
YAML-based GNOME Terminal colour schemes
高级语言: Perl
项目地址: git://github.com/sbakker/gnome-terminal-profile.git
创建时间: 2017-11-28T13:29:56Z
项目社区:https://github.com/sbakker/gnome-terminal-profile

开源协议:GNU General Public License v3.0

下载


YAML Color schemes for Gnome Terminal

Script(s) for defining Gnome Terminal (or Roxterm) themes with a YAML file.

Builds on Anthony25’s gnome-terminal-colors-solarized for solarized Gnome Terminal colours (the
repository is added as a submodule of this repository).

This repository comes with two YAML-base themes: zenburn and ztevenburn.
The zenburn theme is based on planbnet’s gnome-terminal-zenburn.sh, while
ztevenburn similar to Zenburn, but with more contrast (i.e. a darker
background).

Screenshot for comparison:

screenshot

Copyright (C) 2017 Steven Bakker

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.

Requirements

Perl (5.14 or later)

The following modules should be part of the default Perl installation:

  • File::Basename
  • FindBin
  • Getopt::Long
  • Time::Piece

The following modules will probably need to be installed separately:

  • Pod::Usage
  • YAML
  • Term::ReadKey

Initialisation

  1. git clone git@github.com:sbakker/gnome-terminal-profile.git
  2. git submodule init

Usage

See the POD documentation of parse_yaml_theme.pl

  1. perldoc src/parse_yaml_theme.pl
  2. src/parse_yaml_theme.pl --manual

Standalone usage

The install.sh script was copied from Anthony25’s gnome-terminal-colors-solarized
repository and modified to include the use of the YAML parser.

  1. git submodule init
  2. mkdir -p ./colors/my-color
  3. # ... create a colors.yaml in ./colors/my-color
  4. ./install.sh

Using with gnome-terminal-colors-solarized

To use with Anthony25’s gnome-terminal-colors-solarized repository:

Copy your YAML file to a new directory in the colors directory:

  1. mkdir /path/to/gnome-terminal-colors-solarized/my-theme
  2. cp my-theme.yaml /path/to/gnome-terminal-colors-solarized/my-theme/colors.yaml

Then, “compile” it to create the appropriate files:

  1. src/parse_yaml_theme.pl /path/to/gnome-terminal-colors-solarized/my-theme/colors.yaml compile

Finally, use the install.sh script to install the colour theme.

  1. cd /path/to/gnome-terminal-colors-solarized
  2. ./install.sh

Converting gnome-terminal-colors-solarized profiles

Any “classic” profiles can be converted to YAML with the
convert_solarized.sh script.

  1. $ ./convert_solarized.sh
  2. converting gnome-terminal-colors-solarized/colors/dark
  3. converting gnome-terminal-colors-solarized/colors/dark_alternative
  4. converting gnome-terminal-colors-solarized/colors/light

Scripts

install.sh

Copy of Anthony25’s gnome-terminal-colors-solarized‘s install.sh script
with small modifications to load YAML-base color schemes.

convert_solarized.sh

Script to convert “classic” color scheme formats to YAML-based. Just point it
to a directory with a “colors” sub-directory (and optionally specify a prefix
to use for the YAML-based output directory) and the script will do the rest.

show_theme.sh

Can show classic and YAML-based color themes.

  1. # Look in colors/ztevenburn/colors.yaml
  2. ./show_theme colors/ztevenburn/colors.yaml
  3. ./show_theme ztevenburn
  4. # Looks in "classic" gnome-terminal-colors-solarized/colors/light
  5. ./show_theme gnome-terminal-colors-solarized/colors/light

src/parse_yaml_theme.pl

Parse a YAML-based theme.

  1. $ src/parse_yaml_theme.pl ./colors/ztevenburn/colors.yaml
  2. bd_color='#E3CEAB'
  3. bg_color='#1C1C1C'
  4. fg_color='#BABDB6'
  5. palette=( '#1C1C1C' '#DD9393' '#7F9F7F' '#E3CEAB' '#DFAF8F' '#C693A4'
  6. '#8CD0D3' '#BABDB6' '#3F3F3F' '#EEA3A3' '#9FCF9F' '#F3DEBB' '#EFBF9F'
  7. '#D7A3B4' '#9CE0E3' '#DCDCCC' )

Also has a preview option with the show sub-command:

screenshot

src/color_matrix

Show a matrix of the terminal colours. Example with the ztevenburn theme:

screenshot

src/ramp_color

Only works well on a TrueColor terminal.

Given a start color, display a color ramp of increasingly lighter or darker colors, and a demonstration of these colors in a text string.

screenshot

See perldoc src/ramp_color for more information.

src/terminal_colors

Modified clone of the XFree86 256colors.pl. Can print a 256 colour map as well as a list of all extended colors and their RGB values or a visually pleasing spectrum (the latter only for TrueColor terminals).

See perldoc src/terminal_colors for more information.

screenshot

screenshot

src/random_theme.pl

Fun stuff for generating a completely random colour theme. Script spits out a random YAML configuration.

To generate, use random_theme.pl and run parse_yaml_theme.pl to show the
results:

  1. shell$ src/random_theme.pl > wacko.yaml
  2. shell$ src/parse_yaml_theme.pl wacko.yaml show

This will look something like:

screenshot

Then, save the YAML file in a theme directory and install the theme:

  1. shell$ mkdir -p colors/wacko
  2. shell$ mv wacko.yaml colors/wacko/colors.yaml
  3. shell$ ./install.sh -p Wacko -s wacko

The result will then be something like:

screenshot

src/theme_to_yaml.pl

Create a YAML file from a “classic” theme (or display a “classic” theme).

Example:

  1. $ src/theme_to_yaml.pl gnome-terminal-colors-solarized/colors/light

Output:

  1. # YAML dump of gnome-terminal-colors-solarized/colors/light/
  2. # Generated by theme_to_yaml.pl, 30-Nov-2017 16:12:29 +0100
  3. ---
  4. bd: &bd '#58586E6E7575'
  5. fg: &fg '#65657B7B8383'
  6. bg: &bg '#FDFDF6F6E3E3'
  7. color0: [ '#070736364242', '#00002B2B3636' ]
  8. color1: [ '#DCDC32322F2F', '#CBCB4B4B1616' ]
  9. color2: [ '#858599990000', *bd ]
  10. color3: [ '#B5B589890000', *fg ]
  11. color4: [ '#26268B8BD2D2', '#838394949696' ]
  12. color5: [ '#D3D336368282', '#6C6C7171C4C4' ]
  13. color6: [ '#2A2AA1A19898', '#9393A1A1A1A1' ]
  14. color7: [ '#EEEEE8E8D5D5', *bg ]