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