dylanaraps / paleta Goto Github PK
View Code? Open in Web Editor NEWChange terminal colors on-the-fly independent of terminal emulator.
License: MIT License
Change terminal colors on-the-fly independent of terminal emulator.
License: MIT License
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.
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)
Hi,
I already use pywall from you.
Why should I use paleta?
Pywal fits well extracting colours and applying all over...
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!
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!
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.