Uses the k-means algorithm to extract colors from image.
Made using stb_image utilities;
It is extremly opinionated to get the most brigth colors to contrast with the black background of my polybar. The code also calculates the color that most contrast with the ones extracted, in order to use as accent in the system.
# The result is not deterministic !!!
Configured to generate the following files:
$HOME/.cache/dyn_colors.ini: to use in polybar (exposes colors pprim, psec, pterc, pcont);$HOME/.cache/i3_colors: to configure the borders of focused containers in i3 with the color that most contrast with the extracted ones
color_juicer <img_path> <centroids> <downsampling_factor>
img_path: path to the image location in file systemcentroids: number of centroids generateddownsampling_factor: factor to reduce the image resolution
For the image test.png:
color_juicer test.png 5 5 extracts:
and generates:
- on console
pprim: #ECD5A5
psec: #427B92
pterc: #ADA58C
pcont: #716365
- on
$HOME/.cache/dyn_colors.ini:
[dyn_colors]
pprim = #ECD5A5
psec = #427B92
pterc = #ADA58C
pcont = #716365
cprim = #C7A795
csec = #5A6387
- on
$HOME/.cache/i3_colors:
client.focused #716365 #716365 #000000 #ECD5A5 #716365
- Cleanup code
- Generate files to stylize:
- rofi
- dunst
- gtk
- qt








