monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

vomiting-colors.txt (3098B)


      1 # [Vomiting colors](#)
      2 ## — 09 June, 2015
      3 
      4 Creating colorschemes is one of the hardest part of customizing your desktop.
      5 The easiest way to create a new one is to start from a wallpaper made of colors
      6 you like, and then rework it afterward.
      7 
      8 the best tool for this job is without any doubt
      9 [colors](http://git.2f30.org/colors) by sin. It uses [k-means
     10 clustering](https://en.wikipedia.org/wiki/K-means_clustering) to extract
     11 dominant colors from a PNG file, and is able to set those clusters in different
     12 ways.
     13 
     14 Without any further commenting, let's see how it works with this magnificent
     15 picture, randomly taken from the internet:
     16 
     17 [![bamboo.png](http://pub.z3bra.org/monochromatic/img/thumb/20150609-bamboo.png)](http://pub.z3bra.org/monochromatic/img/20150609-bamboo.png)
     18 
     19 `colors` allow you to choose the number of clusters you want to see on the
     20 output, so in our case, we'll output 16. It's possible that `colors` don't
     21 output the number of clusters you asked for. You can "force" outputing empty
     22 clusters with `-e`.
     23 
     24 ![default output](http://pub.z3bra.org/monochromatic/img/20150609-colors0.png)
     25 
     26 Then you can choose how to set your clusters (from the hue domain or pixel space
     27 at the time of writing). Another solution when you don't get the number of
     28 colors you asked for (in my case, I only got 12 colors with -h), is to just ask
     29 for more, and truncate the output. It might give better colors than with `-e`
     30 sometimes.
     31 
     32 ![output from hue](http://pub.z3bra.org/monochromatic/img/20150609-colors1.png)
     33 ![output from pix](http://pub.z3bra.org/monochromatic/img/20150609-colors2.png)
     34 
     35 And then you can randomize the output, if you feel in the mood! You could also
     36 try using the [k-medians](https://en.wikipedia.org/wiki/K-medians) method, which
     37 takes longer but provides a better output regarding the initial file
     38 
     39 ![output random](http://pub.z3bra.org/monochromatic/img/20150609-colors3.png)
     40 
     41 Try different pictures and flag combinations for better results!
     42 
     43 Once you have your output of choice, you can export it as an XRDB colorscheme
     44 with the following script:
     45 
     46     #!/bin/sh
     47 
     48     CPT=0
     49     while read HEXCODE; do
     50         printf '*color%d: %s\n' "$CPT" "$HEXCODE"
     51         CPT=$(expr $CPT + 1)
     52     done | column -t
     53 
     54 This will allow live theme trying with the following command:
     55 
     56     colors -n 16 bamboo.png | toxrdb | xrdb -merge
     57 
     58 Another nice way I found to create colorscheme is by randomizing the colors from
     59 the hue domain, resulting in a monochromatic scheme that fits entirely you
     60 wallpaper. This works by outputing 32 colors, extracting the 16 colors in the
     61 middle and randomizing them. this way, your colors will not be too dark or too
     62 light.
     63 
     64 ![output neat](http://pub.z3bra.org/monochromatic/img/20150609-colors4.png)
     65 
     66 You can then make a script to change your wall every now and then, and change
     67 the colorscheme on the fly. Your colorscheme will ALWAYS match your current
     68 mood!
     69 
     70 <video controls>
     71     <source src="http://pub.z3bra.org/monochromatic/vid/20150609-matchlook.webm" type="video/webm">
     72 </video>
     73 
     74 
     75 **Keep tweaking!**
     76 
     77 <!-- vim: set ft=markdown ts=4 et tw=80: -->