Giter Site home page Giter Site logo

paleta's Introduction

paleta
________________________________________________________________________________

Change terminal colors on-the-fly independent of terminal emulator.

Most terminal emulators support a set of escape sequences which allow for the
modification of the terminal's color palette. Combined with the ability to write
to all open terminal devices, this allows for theming in a truly independent way.

Paleta reads a list of colors over <stdin>, transforms the input into the set of
escape sequences and sends these sequences to every open terminal in the system.
It additionally prints the sequences to <stdout>.

+------------------------------------------------------------------------------+
|                                                                              |
|  $ paleta < palettes/jellybeans-dark > ~/.cache/current-palette              |
|                                                                              |
+------------------------------------------------------------------------------+

This tool is small and generic. It reads input and writes output. Effortless to
incorporate with the system. This repository also contains 150~ popular palettes
ready for use with paleta.


terminal support
________________________________________________________________________________

+------------------------------------------------------------------------------+
|                                                                              |
|  this list is not complete                                                   |
|                                                                              |
|                                                                              |
|  alacritty  good        alacritty/alacritty#656    |
|  kitty      good                                                             |
|  vte [0]    good        1a651cf990e67c4046fbff7674249259bcaa89a8             |
|  xterm      good                                                             |
|  urxvt      good                                                             |
|                                                                              |
|  st         patch       ./misc/st-osc_10_11_12-20200418-66520e1.patch        |
|                                                                              |
|  hyper      clueless    vercel/hyper#2038          |
|                                                                              |
|                                                                              |
+------------------------------------------------------------------------------+

[0] vte includes Termite, XFCE terminal, GNOME terminal, Konsole and many more.


dependencies
________________________________________________________________________________

- POSIX <stdio.h> <stdlib.h> <glob.h>
- C99 compiler


build
________________________________________________________________________________

See src/config.h for configuration.

+------------------------------------------------------------------------------+
|                                                                              |
|  Using make (recommended)                                                    |
|                                                                              |
|  $ make                                                                      |
|  $ make install                                                              |
|                                                                              |
|                                                                              |
|  Invoking the compiler directly                                              |
|                                                                              |
|  $ c99 $CFLAGS -o paleta src/paleta.c                                        |
|                                                                              |
|                                                                              |
+------------------------------------------------------------------------------+


usage
________________________________________________________________________________

+------------------------------------------------------------------------------+
|                                                                              |
|  1. Set the colorscheme to jellybeans-dark in all open terminals.            |
|                                                                              |
|  $ paleta < palettes/jellybeans-dark > ~/.cache/current-palette              |
|                                                                              |
+------------------------------------------------------------------------------+

Saving paleta's <stdout> to a file is how the current palette is stored. This
file is used to set the palette in newly opened terminals. Scripts might instead
store this in a variable or ignore it entirely as they maintain state.


setup
________________________________________________________________________________

This line must be added to $SHELL's startup file. It tells future terminals to
load the current palette at launch.

+------------------------------------------------------------------------------+
|                                                                              |
|  $ echo 'cat ~/.cache/current-palette' >> ~/.bashrc                          |
|                                                                              |
+------------------------------------------------------------------------------+


input format
________________________________________________________________________________

Input is one hex color per line, without #. The first three lines are
reserved for <foreground>, <background> and <cursor> with the remaining lines
filling the numerical palette (0-256).

Example: https://github.com/dylanaraps/paleta/blob/master/palettes/gruvbox-dark

+------------------------------------------------------------------------------+
|  format                             |  example                               |
+-------------------------------------+----------------------------------------+
|                                     |                                        |
|  <foreground>                       |  dedede                                |
|  <background>                       |  121212                                |
|  <cursor>                           |  dedede                                |
|  <color0>                           |  929292                                |
|  <color1>                           |  e27373                                |
|  <color2>                           |  94b979                                |
|                                     |                                        |
|  ...                                |  ,,,                                   |
|                                     |                                        |
|  <color256>                         |  1ab2a8                                |
|                                     |                                        |
|                                     |                                        |
+-------------------------------------+----------------------------------------+

The maximum palette is (3 + 256). This is configurable at compile-time.


software written around paleta
________________________________________________________________________________

- shuffle through palettes in a directory. https://github.com/dylanaraps/bin/blob/c06b2c0df0194487fc4cb9c65b451b6369e2c398/shuffle


todo
________________________________________________________________________________

- [ ] Find good 256 color palettes to include. All are currently 16 colors.
      256 color palettes added to this repository should contain -256 in their
      filenames.

paleta's People

Contributors

adrianstaniec avatar dylanaraps avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

paleta's Issues

[Feature] Include palettes/ in share/paleta when make installing

Pretty much title

diff --git a/Makefile b/Makefile
index 63a53da..e71085a 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,9 @@ $(OBJ): $(HDR)
 install: paleta
        mkdir -p $(DESTDIR)$(PREFIX)/bin
        cp paleta  $(DESTDIR)$(PREFIX)/bin/
-
+       mkdir -p $(DESTDIR)$(PREFIX)/share/paleta
+       cp -r palettes/ $(DESTDIR)$(PREFIX)/share/paleta/
+       
 clean:
        rm -f paleta $(OBJ)

pywall

Hi,
I already use pywall from you.
Why should I use paleta?
Pywal fits well extracting colours and applying all over...

Problem with executable name

Hello!

Program with the same name of executable already exists, that could make problems with installation and creating packages. Could you rename utility? Quite a bit of time has passed from the publication.

P.S. Nice utility, thank you!

Allow setting foreground and background independently of 0-15

This is a brilliant utility for seamlessly changing color theme across xterms. How pal sends command sequences works much better than what I had been trying: calling xdotool search --class xterm to create a stack of xterm windows and then calling xdotool again to send (after changing the dubious xterm*AllowSendEvents setting) each xterm xtermcontrol commands that change the colors... ugh. Not a good solution. I want to use a tool like pal that works with command sequences directly.

For my use, I am trying to use pal to switch all xterms between Solarized Dark and Solarized Light themes. As far as I can tell, these themes require slightly more complex sequences than your utility currently allows. The foreground and background colors cannot simply be assumed to be colors 0 and 15, and other settings like the cursor color must be set to specific values.

Per the official Solarized repo, the Solarized dark color scheme is specified as follows in a Xresources file:

#define S_base03        #002b36
#define S_base02        #073642
#define S_base01        #586e75
#define S_base00        #657b83
#define S_base0         #839496
#define S_base1         #93a1a1
#define S_base2         #eee8d5
#define S_base3         #fdf6e3
#define S_yellow        #b58900
#define S_orange        #cb4b16
#define S_red           #dc322f
#define S_magenta       #d33682
#define S_violet        #6c71c4
#define S_blue          #268bd2
#define S_cyan          #2aa198
#define S_green         #859900

!mappings
*background:            S_base03
*foreground:            S_base0
*fadeColor:             S_base03
*cursorColor:           S_base1
*pointerColorBackground:S_base01
*pointerColorForeground:S_base1

!! black dark/light
*color0:                S_base02
*color8:                S_base03

!! red dark/light
*color1:                S_red
*color9:                S_orange

!! green dark/light
*color2:                S_green
*color10:               S_base01

!! yellow dark/light
*color3:                S_yellow
*color11:               S_base00

!! blue dark/light
*color4:                S_blue
*color12:               S_base0

!! magenta dark/light
*color5:                S_magenta
*color13:               S_violet

!! cyan dark/light
*color6:                S_cyan
*color14:               S_base1

!! white dark/light
*color7:                S_base2
*color15: 		S_base3

So, I assume my next step would be to fork pal, in which I alter the following lines of make_sequences():

    # 10: Foreground color,
    # 11: Background color,
    # 12: Cursor Foreground color.
    # Source: https://goo.gl/KcoQgP
    sequences+="\\e]10;${colors[15]}\\e\\\\"
    sequences+="\\e]11;${colors[0]}\\e\\\\"
    sequences+="\\e]12;${colors[15]}\\e\\\\"

to set the correct background, foreground, pointerColorForeground values. I would then add similar lines that set fadeColor, cursorColor, and pointerColorBackground to the Solarized spec as well.

Thanks for any help/suggestions. Just thinking out loud. I would like to make pal's magic available to Solarized users wishing for a sane way to switch all their xterms to dark themes at sundown and light themes at sunup!

Messed up colors in termite

When setting the colors through pal in termite, the color scheme becomes messed up. When attempting to set a theme such as materia, the output is completely different than what its supposed to, with the colors being in the wrong places.

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.