GithubHelp home page GithubHelp logo

protesilaos / prot16-generator Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 63 KB

A nimble tool to automate the process of exporting the Prot16 colour schemes to a variety of applications and terminals.

Home Page: https://protesilaos.com/schemes

License: GNU General Public License v3.0

Shell 100.00%
prot16 prot16-builder prot16-generator urxvt xfce4-terminal vim hyper colorschemes syntax-highlighting

prot16-generator's Introduction

Prot16 Generator

A nimble tool to automate the process of exporting the prot16 colour schemes into a variety of file formats. The output is used to style applications such as terminal emulators or Vim.

The generator consists of a bash script which parses the sets of variables of each scheme through templates and outputs the result to the terminal (stdout).

Usage

Start by cloning the repo:

git clone https://github.com/protesilaos/prot16-generator.git --depth 1

Then enter the directory (all subsequent commands assume you are working within the prot16-generator directory):

cd prot16-generator

Run the script with the necessary arguments (see following section):

./prot16-generator [scheme] [template] [variant]

Available CLI arguments

For the available schemes, run ls schemes. Similarly, run ls templates. The variant must be either light or dark.

Examples

Print the gaia theme for vim in its dark variant to the terminal output:

./prot16-generator gaia vim dark

Directly create a new file containing the output and place in on the ~/Desktop:

./prot16-generator gaia vim dark > ~/Desktop/gaia_dark.vim

Applying the themes

Each application uses a different set of conventions. Below are some tried and tested examples that I have run on Arch Linux as well as Debian and Debian-based distros (Ubuntu and Linux Mint). Technically these should be distro-agnostic, though I cannot be certain of that (please report any issues).

RXVT-Unicode (urxvt)

Urxvt saves colour values in either of two places. The most common use case is within the ~/.Xresources. Since that file can contain all sorts of configurations, it is best to append the output of the prot16-generator rather than overwrite its contents.

As such, run the following command:

./prot16-generator gaia urxvt dark >> ~/.Xresources

Notice the use of >>. It is what appends the output to the file. If your .Xresources is empty, then just run the following instead (notice the single >):

./prot16-generator gaia urxvt dark > ~/.Xresources

The other approach to having colour values for urxvt is to source an .Xcolors file from within the .Xresources. The file can be located anywhere. For the purposes of this tutorial, it is assumed you have created a directory ~/.urxvt-themes/:

# Create directory for urxvt Xcolors
mkdir ~/.urxvt-themes

# Generate the desired theme and place it in the new directory
./prot16-generator gaia urxvt dark > ~/.urxvt-themes/gaia_dark.Xcolors

Then source that file from within the .Xresources with the following line (note that comments in .Xresources start with a !, not an #):

#include </home/USERNAME/.urxvt-themes/gaia_dark.Xcolors>

Whatever method you use, do not forget to reload the configurations, with xrdb -merge ~/.Xresources (may need to close all terminals and re-open them).

Xterm

Much like urxvt, xterm stores its configurations in ~/.Xresources. Append the theme of your choice to the existing configs with the following:

./prot16-generator gaia xterm dark >> ~./Xresources

Xfce4-terminal

The theme files can be located in either of two places:

  • At /usr/share/xfce4/terminal/colorschemes/ which makes them accessible to all users (requires root privileges).
  • Or ~/.local/share/xfce4/terminal/colorschemes/ for use by the current user (directory path needs to be created if it does not already exist).

Choose whatever option suits your needs, modifying the following command accordingly:

# Create directory if it does not already exist (ONLY for the .local option)
mkdir -p ~/.local/share/xfce4/terminal/colorschemes/

# Generate the theme and place it in the created directory
./prot16-generator gaia xfce4-terminal dark > ~/.local/share/xfce4/terminal/colorschemes/gaia_dark.theme

The theme will then be available from the terminal's preferences panel. Specifically, open the Xfce4 Terminal, navigate to Preferences > Colours. The themes should be available in the Presets section.

Vim

The theme files can be copied manually or installed as a bundle with a plugin.

The manual method requires you to copy the file to ~/.vim/colors/. Run the following command:

# Create path to colors directory if it does not already exist
mkdir -p ~/.vim/colors/

# Generate theme and place it in the newly created directory
./prot16-generator gaia vim dark > ~/.vim/colors/gaia_dark.vim

As for the plugin, you can use your favourite plugin manager. With vim-plug add the following line to your .vimrc:

Plug "protesilaos/prot16-vim"

Then execute the plugin manager's command to update the plugin files.

Once available, the theme is declared with the following options inside the .vimrc:

" Theme
syntax enable
colorscheme gaia_dark

Roadmap (help is much appreciated)

  • Refine the code.
  • Improve documentation.
  • Improve templates where possible.
  • Produce templates for other popular apps (Termite, Kitty, Tilix, etc.).
  • Packages for various GNU/Linux distros (if packages are an option, there needs to be a manpage and a more streamlined CLI experience, such as prot16 --help prot16 [options]).
  • Anything else?

Changelog

Refer to the CHANGELOG.md

License

GNU General Public License Version 3.

See LICENSE

Miscellaneous

The Prot16 Generator replaces the prot16-builder

prot16-generator's People

Contributors

jsit avatar protesilaos avatar toniz4 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jsit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.