A bash(y) alternative to pywal by mostly using pastel to generate the full 255 colors from an image.
lule --image=/some/path/of/an/image.jpg --palette=convert set
Well, not actually frequent asked quenstions (cos this tool is still new, still no questions), but just some predicted FAQ:
Well, lule is divided in two separate scripts lule and lule_colors. lule is responsible to generate colors and all
other options related to color generation and is 99.9% of the code. In the other side lule_color is extremely simple,
it just sends those colors to apps like: all open tty's, or firefox through pywalfox, or neovim...
The advantages to pywal are that lule genretarates all 255 colors from, not just 8 (or 16). Many times, when you want to apply colors (especially in neovim) you need more shades of the accent color, and that is why i made this tool initially.
Well, initially i made a simple script to add more colors to pywal. Then many times pywal was having problems with other python packages, thus i completely substituted it with pastel. Then the script grew larger and i thouth of sharing instead of using just by myself.
In the future (when and if i have enogh time), i will make it a binary (rust or go) and then you are saved from dependency hell.
They are from the very talented Michal from Czech Republic, a freelance digital artist and illustrator. You can get (buy) all his wallpapers from his artstation or support him in patreon to get at least five high-quality wallpapers per month (worth every penny, trust me).
lule v.0.1
a command line to set 255 colors on tty's and other places that use ANSI colors
USAGE:
lule [options][flags] <command>
lule <special> [flags]
OPTIONS:
--palette[=]<name> -> { pigmnts } , schemer2 , convert , imgscheme ,
specify the palete binary to use
--configs[=]<filepath> :: or specify $LULE_C as environment variable
specify a config file where to load color preferences
--scheme[=]<name> -> default ,
specify the scheme form configs
--sort[=]<name> -> brightness , luminance , hue , { chroma } , random ,
specify the soring colord of pallete
--saturate[=]<value> -> only numbers (0.0-1.0) are valid
ammout of saturation of main colors
--image[=]<filepath>
specify the image to extract colors from
--script[=]<filepath> :: or specify $LULE_S as environment variable
specify an external script to run after colors are genrated
--wallpath[=]<dirpath> :: or specify $LULE_W as environment variable
specify a folder to pick an image randomly
--loop[=]<seconds> -> only numbers are valid
loop thrugh direcory (needs $LULE_W or $--wallpath)
FLAGS:
-n dont set wallpaper
-d dont set colors
-p read values from pipe/stdin
-f refresh the colors *
-r reset default colors *
flags marked with: * should be used alone eg.: lule -r
COMMANDS:
set generate new colors from new image
regen generate new colors from same image
theme invert dark and light theme
pick pick a color as accent color
SPECIAL:
colors [flags] print all 255 colors in terminal *
palette [flags] more info about diffenert palette generators *
configs [flags] set and save color configure options *
commands marked with * have their own flags, check: lule <special> -h
This tool assumes (depends) that you have all those tools into your path:
| tool and link | usage |
|---|---|
| pastel | Color manipulation |
| jq | Load and save configs |
| feh | Applying wallpaper |
| xcolor | Picking a color from X11 screen |
In addition, this tool relies on common GNU tools like: awk, grep, sed ...
And wants at least one of those tools:
| tool and link | usage |
|---|---|
| pigmnts | color palette from image |
| schemer2 | color palette from image |
| convert | color palette from image |
| imgscheme | color palette from image |
A 256-color lookup tables is common in almost all modern terminals thus escape sequences were added to select from a pre-defined set of 256 colors. This tool lule genarates all those colors from an image. There are few steps in color generation:
In this step, an imige is provided as input then most dominant colors are generated. One of the dependency tools showed above will be used to generate 16 dominant colors.
Two immportant colors: $DARK="#000000" and $LIGHT="FFFFFF" color variable are created. Those colors would server
to blend all other colors after
After colors are generated, top 6 colors are seleced based on a filter (hue, illumiance ...) explained later in options.
Those woule be: $col1, $col2, $col3, $col4, $col5, $col6
First color $col1 from those 6 is selected, and saturated as the accent color $ac (which is the most important color of all)
Background and foreground colors are then generated by mixing $ac with $DARK for $col0 to give a shade of
accent to backgroundcolor. The same with foreground, mixing $ac with LIGHT to generate col15
Then colors col7 and col8 are generated by mixing $ac with #AAAAAA and $ac with #666666 respectively.
From colors $col1 ($ac), $col2, $col3, $col4, $col5, $col6 generate a less saturated version of each an use as colors
$col9, $col10, $col11, $col12, $col13, $col14
Grayscale colors are not precisely grayscale, but in original ANSI 255 colors, they are grayscale, hence the name. Those colors
are shades of accent colors.
Those colors blend from $DARK to $col0 to $col1 to $col15 and lastly to $LIGHT, so at then end we have a nice color
progession from black to black acented to accent istelf to white accented an finally to white:
$col232is same as$DARK$col233is blend betwen$DARKand$col0(background color)$col234is same as$col0(background color)$col235to$col242are a blend betwen$col0(background color) and$accol243is similar or slighty darker color of$accol244is similar or slighty lighter color of$ac$col245to$col252are a blend betwen$col15(foreground color) and$ac$col253is same as$col15(foreground color)$col254is blend betwen$LIGHTand$col15(foreground color)$col255is same$LIGHT
Other colors represent colors that are not exacly extracted from the image. There are in total 18 other colors defined, each with
its own shades going from $DARK to color to $LIGHT, thus each color is represented with 12 different shades.
- Each group is represented with its own
$COLORhex value - Then generate 14 colors from
$DARKto$COLORto$LIGHT - Remove first (
$DARK) and last ($LIGHT) to leave exacly 12 colors
It represents three groups: RED, GREEN, BLUE but all mixed with $ac.
- In colors 16 to 27 the variable
$COLORis a blend between RED#FF0000and$ac - In colors 28 to 39 the variable
$COLORis a blend between GREEN#00FF00and$ac - In colors 40 to 51 the variable
$COLORis a blend between BLUE#0000FFand$ac
It represents original RED GREEN BLUE MAGENTA YELLOW and CYAN colors
- In colors 52 to 63 the variable
$COLORis RED#FF0000 - In colors 64 to 75 the variable
$COLORis GREEN#00FF00 - In colors 76 to 87 the variable
$COLORis BLUE#0000FF - In colors 88 to 99 the variable
$COLORis MAGENTA#FF00FF - In colors 100 to 111 the variable
$COLORis YELLOW#FFFF00 - In colors 112 to 123 the variable
$COLORis CYAN#00FFFF
It represents original shades of gray
- In colors 124 to 135 the variable
$COLORis GRAY#888888
There are left 8 groups. Anod for those gorups, $COLOR is randomly geretated, then all shades are generated
This tool depends on few environemnt variables too:
$LULE_W -- wallpaper directory
$LULE_S -- script filepath
$LULE_C -- configs filepath
For example, if you dont want to specify allways your folder directory where your wallpapers are, you can smply
specify $LULE_W variable (and it shoud be a direcory) then lule picks an image there (randomly) to set as wallpaper.
Alternaitve you can still use lule --walldir=<dirpath> which has presedence to $LULE_W
Then, LULE_C, is where a config file for lule is. If you don't set this variable, then this is automatically
set to $XDG_CONFIG/lule/config.json or $HOME/.config/lule/config.json
Alternaitve you can still use lule --script=<filepath> which has presedence to $LULE_C
Finally, there is $LULE_S, which should be a file/script, that lule will run autmatically after colors are generated.
Usually here can be scripts for updating colors for NEOVIM, FIREFOX with pywalfox
and other scripts that you might find useful. Please check lule_colors from this repo to get started.
The script is forked, thus it does not affect the lule app itself.
Alternaitve you can still use lule --script=<filepath> which has presedence to $LULE_S
IMPORTANT: Colors are not applied by lule itslef, you need an external script to do that. For that you can check lule_colors that sends all the sequence of colors to all open tty's and updating the colors instantly.
There are four main commands in lule
set -- generate new colors from new image
regen -- generate new colors from same image
theme -- invert dark and light theme
pick -- pick a color as accent color
This is main command to set a new colorscheme.
It needs either $LULE_W to be set before using it:
LULE_W=$HOME/.local/share/wallpapers
lule set
Or using --walldir=<path> to specify before using it:
lule --walldir="LULE_W=$HOME/.local/share/wallpapers" set
Here are some examples from four different images:
Its one of the commands that regenreates colors from the same image. Very useful when
you want to change the --palette or --sort which are explained later in OPTIONS
It simply switches from dark to light of current colorscheme, or vice-versa. Every time lule theme
is run, it alternates between those two.
As explained in black and white, variables $DARK" and $LIGHT are created at the begining.
This command simply inverts them, thus if $DARK is "#000000" and $LIGHT is "FFFFFF" then $DARK becomes #FFFFFF
and $LIGHT becomes #000000, and vice versa.
Here an example of by simply running lule theme:
- Dark theme (colrs)
- Light theme (colors)
- Dark theme (neovim)
- Light theme (neovim)
- Dark theme (firefox using pywalfox)
- Light theme (firefox using pywalfox)
Its a command that depends on xcolor to pick as $ac one color from the picker.
From that picked color all other colors are regenerated.
There are some other special commands in lule too
colors -- print all 255 colors in terminal
palette -- more info about diffenert palette generators
configs -- set and save color configure options
each of the has its own subcommands and flags, use lule <special> -h from more info