• This repository has been archived on 08/Apr/2018
  • Stars
    star
    730
  • Rank 62,081 (Top 2 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐ŸŽจ Generate and change colorschemes on the fly. Deprecated, use pywal instead. -->

NOTE: Development focus has been shifted to pywal.

pywal is a Python 3 version of wal written by me. It's faster, the code is cleaner, it actually has tests(!) and it supports more export formats. pywal can also be installed easily on any distro by using pip install pywal.

For a list of differences between pywal and wal, take a look at this wiki page: What's different in pywal?

Repo link: https://github.com/dylanaraps/pywal

wal

MIT licensed Build Status

wal is a script that takes an image (or a directory of images), generates a colorscheme (using imagemagick) and then changes all of your open terminal's colorschemes to the new colors on the fly. wal then caches each generated colorscheme so that cycling through wallpapers while changing colorschemes is instantaneous. wal finally merges the new colorscheme into the Xresources db so that any new terminal emulators you open use the new colorscheme.

wal can also change the colors in some other programs, check out the Customization section below.

NOTE: wal is not perfect and won't work with some images.

Albums of examples (Warning large)

screen

Table of Contents

Requirements

Dependencies

  • bash
  • imagemagick
    • Colorscheme generation
  • xfce, gnome, cinnamon, mate
    • Desktop wallpaper setting.
  • feh, nitrogen, bgs, hsetroot, habak
    • Universal wallpaper setting.
  • xprop
    • Used to detect which DE wallpaper setter to use.
    • Only required if you're running a DE.

Terminal Emulator

To use wal your terminal emulator must support a special type of escape sequence. The command below can be used as a test to see if wal will work with your setup.

Run the command below, does the background color of your terminal become red?

printf "%b" "\033]11;#ff0000\007"

If your terminal's background color is now red, your terminal will work with wal.

Installation

Just grab the script (wal) and add it to your path.

Setup

NOTE: If you get junk in your terminal, add -t to all of the wal commands.

Applying the theme to new terminals.

wal only applies the new colors to the currently open terminals. Any new terminal windows you open won't be using the new theme unless you add a single line to your shell's start up file. (.bashrc, .zshrc etc.) The -r flags tells wal to find the current colorscheme inside the cache and then set it for the new terminal.

Add this line to your shell startup file. (.bashrc, .zshrc or etc.)

# Import colorscheme from 'wal'
(wal -r &)

Here's how the extra syntax above works:

&   # Run the process in the background.
( ) # Hide shell job control messages.

Making the colorscheme persist on reboot.

On reboot your new colorscheme won't be set or in use. To fix this you have to add a line to your .xinitrc or whatever file starts programs on your system. This wal command will set your wallpaper to the wallpaper that was set last boot and also apply the colorscheme again.

Without this you'll be themeless until you run wal again on boot.

# Add this to your .xinitrc or whatever file starts programs on startup.
wal -i "$(< "${HOME}/.cache/wal/wal")"

Usage

Run wal and point it to either a directory (wal -i "path/to/dir") or an image (wal -i "/path/to/img.jpg") and that's all. wal will change your wallpaper for you and also set your terminal colors.

Usage: wal [OPTION] -i '/path/to/dir'
Example: wal -i '${HOME}/Pictures/Wallpapers/'
         wal -i '${HOME}/Pictures/1.jpg'

Flags:
  -a                      Set terminal background transparency. *Only works in URxvt*
  -c                      Delete all cached colorschemes.
  -f '/path/to/colors'    Load colors directly from a colorscheme file.
  -h                      Display this help page.
  -i '/path/to/dir'       Which image to use.
     '/path/to/img.jpg'
  -n                      Skip setting the wallpaper.
  -o 'script_name'        External script to run after 'wal'.
  -q                      Quiet mode, don't print anything.
  -r                      Reload current colorscheme.
  -t                      Fix artifacts in VTE Terminals. (Termite, xfce4-terminal)
  -x                      Use extended 16-color palette.

Plugins

Listed below are plugins for other programs that add support for wal colors.

Hyper Terminal

https://github.com/dneustadt/hyper-wal

Customization

I've written another script [1] for personal use only that updates my lemonbar, dunst and startpage colors with the new ones from wal when run.

What I've done is bind both wal and my custom script to the same key so that after wal has done its thing my custom script applies the colors to the rest of my environment.

# i3 config.
# ...

# Cycle wallpapers and apply new colorscheme.
bindsym $mod+w exec "wal -i $HOME/Pictures/Wallpapers -o wal-set"

Now whenever I press Win+w a random wallpaper is chosen and all of the programs on my system start using the new colors immediately.

I've also set wal and my custom script to start with X. This means that when I boot my PC a random wallpaper is chosen and colors are generated + applied to all of my programs.

# .xinitrc
wal -i "$HOME/Pictures/Wallpapers" -o wal-set
exec i3

Have a look at my script to see how wal is used and how the programs get reloaded with the new colors.

[1] https://github.com/dylanaraps/bin/blob/master/wal-set

NOTE: wal stores the exported files in $HOME/.cache/wal/

i3

To use wal with i3 you have to make some modifications to your i3 config file.

i3 can read colors from Xresources into config variables! This allows us to change i3's colors dynamically. On run wal will detect that you're running i3 and reload your config for you. If you've set it up correctly i3 will then use your new colorscheme.

Example:

# Set colors from Xresources
# Change 'color7' and 'color2' to whatever colors you want i3 to use
# from the generated scheme.
# NOTE: The '#f0f0f0' in the lines below is the color i3 will use if
# it fails to get colors from Xresources for some reason.
set_from_resource $fg i3wm.color7 #f0f0f0
set_from_resource $bg i3wm.color2 #f0f0f0

# class                 border  backgr. text indicator child_border
client.focused          $bg     $bg     $fg  $bg       $bg
client.focused_inactive $bg     $bg     $fg  $bg       $bg
client.unfocused        $bg     $bg     $fg  $bg       $bg
client.urgent           $bg     $bg     $fg  $bg       $bg
client.placeholder      $bg     $bg     $fg  $bg       $bg

client.background       $bg

# PROTIP: You can also dynamically set dmenu's colors this way:
bindsym $mod+d exec dmenu_run -nb "$fg" -nf "$bg" -sb "$bg" -sf "$fg"

rofi

wal updates rofi's colors for you out of the box, automatically.

vim

Inside this repo there's a colorscheme I created for vim that uses your terminal colors. It was made to work with the colors wal generates and you can install it using any vim package manager.

Example:

! Using plug
Plug 'dylanaraps/wal'

colorscheme wal

Emacs

Install this package, which will make Emacs use your X environment's colors instead of its default colors.

polybar

Polybar can read colors from Xresources to set the bar's colors.

Example:

fg = ${xrdb:color7}
bg = ${xrdb:color2}

iTerm2

There's a script called wal2iterm in contrib/wal2iterm which converts the generated colors to an importable iTerm2 colorscheme.

The themes are stored in the wal cache directory. (${HOME}/.cache/wal/itermcolors).

Example:

wal -i "IMAGE" -o "/path/to/wal2iterm/wal2iterm"

Shell Variables

wal also exports the colorscheme as a list of shell variables that you can source for use in scripts and the shell.

Example:

# Add this line to your .bashrc or a shell script.
source "$HOME/.cache/wal/colors.sh"

In the shell:

# Once the file is sourced you can use the colors like this:

dylan ~ >echo "$color0"
#282A23

dylan ~ >echo "$color0 $color5"
#282A23 #BCC3CE

# lemonbar example
lemonbar -B "$color7" -F "$color0"

SCSS variables

wal also exports the colorscheme as SCSS variables for use in webpages. I'm using this feature to update my startpage with the new colors dynamically.

Example:

// Example .scss file

// Import Colors
@import '/home/dylan/.cache/wal/colors.scss';

body {
    background: $color0;
    color: $color7;
}

Firefox variables

wal also exports the colors as Firefox CSS variables for use with Stylish or userChrome.css.

Example Firefox CSS:

/* Import the CSS file.
   NOTE: This must be at line 1 of your Firefox stylesheet. */
@import url('file:///home/dylan/.cache/wal/firefox.css')

/* Use the variables */
#nav-bar {
    background-color: var(--color3) !important;
    color: var(--color7) !important;
}

PuTTY

wal also exports the colors so they can be used with PuTTY. After running wal, a file will be created ($HOME/.cache/wal/colors.reg) that can be executed on a Windows machine to create a new PuTTY session with the generated colors. Once the file is executed, you can select Wal from the Saved Sessions list.

Scripting

wal also exports the colors in a plain text format. This is helpful when you want use the plain colors in another script. See the script in contrib/wal2iterm for an example.

The file is called colors and just contains the hex values one per line in the order of 0-15.

Example colors file:

#0C2B32
#9C7648
#B78742
#B4884D
#AC8C64
#D19D62
#61828A
#F0DEC0
#666666
#9C7648
#B78742
#B4884D
#AC8C64
#D19D62
#61828A
#F0DEC0

Example usage in a script:

# Create an array with the plain hex colors ordered 0-15.
c=($(< "${cache_dir}/colors"))

# Remove the leading '#' if needed.
c=("${c[@]//\#}")

Custom Switcher

You can also manually create your own colors files and load them directly with the wal -f option to quickly switch between your favorite colorschemes without changing the background.

# Switch to previously saved Monokai colorscheme

wal -f "$HOME/.colors/monokai"

# Switch to previously saved Solarized colorscheme
wal -f "$HOME/.colors/solarized"

Terminal.sexy

You can import wal's colors into Terminal.sexy by copy-pasting the contents of the colors.xresources file located in the cache directory.

More Repositories

1

pure-bash-bible

๐Ÿ“– A collection of pure bash alternatives to external processes.
Shell
36,517
star
2

neofetch

๐Ÿ–ผ๏ธ A command-line system information tool written in bash 3.2+
Shell
21,666
star
3

pywal

๐ŸŽจ Generate and change color-schemes on the fly.
Python
8,250
star
4

pure-sh-bible

๐Ÿ“– A collection of pure POSIX sh alternatives to external processes.
Shell
6,485
star
5

fff

๐Ÿ“ A simple file manager written in bash.
Shell
4,088
star
6

pfetch

๐Ÿง A pretty system information tool written in POSIX sh.
Shell
2,053
star
7

sowm

An itsy bitsy floating window manager (220~ sloc!).
C
913
star
8

pxltrm

๐Ÿ–Œ๏ธ pxltrm - [WIP] A pixel art editor inside the terminal
Shell
650
star
9

dotfiles

๐Ÿ™ dotfiles
Vim Script
545
star
10

writing-a-tui-in-bash

How to write a TUI in BASH
518
star
11

pash

๐Ÿ”’ A simple password manager using GPG written in POSIX sh.
Shell
341
star
12

birch

An IRC client written in bash
Shell
319
star
13

torque

๐Ÿš‚ A TUI client for transmission written in pure bash.
Shell
229
star
14

wal.vim

๐ŸŽจ A vim colorscheme for use with wal
Vim Script
219
star
15

shfm

file manager written in posix shell
Shell
216
star
16

promptless

๐Ÿš€ A super fast and extremely minimal shell prompt.
Shell
188
star
17

paleta

Change terminal colors on-the-fly independent of terminal emulator.
C
185
star
18

bin

๐Ÿ—‘๏ธ scripts
Shell
146
star
19

bum

๐ŸŽต Download and display album art for mpd/mopidy tracks.
Python
137
star
20

openbox-patched

PKGBUILD and patches for Openbox with Rounded Corners
112
star
21

fff.vim

A plugin for vim/neovim which allows you to use fff as a file opener.
Vim Script
104
star
22

bareutils

A coreutils written in pure bash.
Shell
89
star
23

k

kiss pkg man written in c
C
55
star
24

clutter-home

clutter your home directory!
50
star
25

eiwd

iwd without dbus
C
47
star
26

barsh

Use your terminal as a bar
Shell
39
star
27

nosj

a json parser written in pure bash
Shell
37
star
28

dylanaraps

37
star
29

bush

This is an experiment to see how many standard tools and functions we can re-implement in pure bash.
Shell
33
star
30

crayon

๐ŸŽจ A dark 16 color colorscheme for Vim, Gvim, and Nvim
Vim Script
29
star
31

startpage

๐Ÿ”— Simple start page written in HTML/SCSS
CSS
29
star
32

ryuuko

๐ŸŽจ A colorscheme~
Vim Script
28
star
33

wiki

KISS Linux - Wiki (The wiki is now a part of the website)
27
star
34

pow

Shell
25
star
35

hello-world.rs

๐Ÿš€Memory safe, blazing fast, configurable, minimal hello world written in rust(๐Ÿš€) under 1 line of code with few(774๐Ÿš€) dependencies๐Ÿš€
Rust
25
star
36

root.vim

๐ŸŒด Automatically set directory to your project's root based on a known dir/file.
Vim Script
23
star
37

nfu

Neofetch Utils - A set of C programs to print system information.
C
22
star
38

wm

xcb wm
C
20
star
39

pkg

Package Manager for Kiss Linux
Shell
18
star
40

neofetch-branding

Logos for Neofetch
16
star
41

codegolf

my bash code golfs
16
star
42

okpal

okpal - Swap on the fly between a bunch of palettes
Shell
15
star
43

eiwd_old

SEE: https://github.com/dylanaraps/eiwd
C
14
star
44

taskrunner.nvim

๐Ÿƒ Runs Gulp/Gruntfiles in terminal splits
Vim Script
14
star
45

discord-selena

Log all Discord messages for transparency
Python
12
star
46

libdbus-stub

stub libdbus to appease
C
12
star
47

blog

Shell
11
star
48

dylan-kiss

Dylan's KISS repository
Objective-C
11
star
49

kiss-flatpak

flatpak for kiss
Shell
11
star
50

str

C
10
star
51

kiss-initramfs

[WIP] initramfs tool for KISS (help wanted!)
Shell
9
star
52

sowm-patches

READ: https://github.com/dylanaraps/sowm/pull/57
8
star
53

golfetch

simple fetch script for Linux.
Shell
8
star
54

coal

๐Ÿš‚ A bash script that takes a list of colors and outputs them in various formats for use in other programs.
Shell
8
star
55

reddit-sidebar-toggle

๐Ÿ‘ฝ Toggle the sidebar on reddit.com
JavaScript
8
star
56

dylan.k1ss.org

HTML
7
star
57

wayland-experiment

Shell
6
star
58

uncompress

6
star
59

pywal-branding

Logos for pywal
Shell
5
star
60

xyz-redirect

simply a cheeky way to 301 redirect https to another domain leveraging netlify to handle the SSL cert.
HTML
5
star
61

repo

๐Ÿ“ฆ Dylan's Cydia Repo
Shell
5
star
62

dlink-ssid-bypass

๐Ÿ“ก Bypass SSID validation on D-Link DSL-2750B
4
star
63

pascal_lint.nvim

๐Ÿ† Show fpc compiler output in a neovim split.
Vim Script
4
star
64

blag

blag
HTML
3
star
65

oldyiayias

Old website for Yiayias Greek Cafe
CSS
3
star
66

languages

Shell
3
star
67

kisslinux-irc-logs

Freenode #kisslinux IRC logs (2019-2021)
3
star
68

dylanaraps.github.io-old

๐Ÿ”— My personal website.
HTML
2
star
69

google

Remake of Google.com for an assignment
HTML
2
star
70

2211

mnml trmnl using vte
C
2
star
71

kiss-submodule-links

Shell
2
star
72

eww-static-test

Rust
1
star
73

yiayias

Recreating Yiayia's website 6 months later
HyPhy
1
star