├── README.md ├── pic.png └── rangeela.py /README.md: -------------------------------------------------------------------------------- 1 | # rangeela 2 | 3 | ## What is it? 4 | 5 | **rangeela** in 'Hindi' means colourful. 6 | Rangeela is a little script to generate an image full of randomly coloured 7 | squares, which you can set as your wallpaper or whatever you feel like. 8 | 9 | ## Quick Start 10 | 11 | Installation requires [**`python2`**](https://docs.python.org/2/) obviously, 12 | **gtk** for reading the screen resolution, and **PIL** ([Python Image Library](https://en.wikipedia.org/wiki/Python_Imaging_Library)) 13 | 14 | You can install all of them from your favorite package manager, if you are like 15 | me using Arch(or Arch-like) then you can search your official repos using 16 | ```linux 17 | sudo pacman -Ss 18 | ``` 19 | 20 | ## Instructions 21 | 22 | 1. `$ git clone https://github.com/anshulc95/rangeela.git ~/rangeela` 23 | 2. `$ cd ~/rangeela` 24 | 3. `$ python2 rangeela.py` 25 | 4. Now your wallpaper is generated, you can use your preferred wallpaper manager 26 | to set *this* as your wallpaper. 27 | 28 | ## Example 29 | 30 | This is what the wallpaper is going to look like: 31 | 32 | ![pic](https://raw.githubusercontent.com/anshulc95/rangeela/master/pic.png) 33 | 34 | ## Inspiration 35 | 36 | [colorblobks](https://github.com/zzggbb/colorblocks) 37 | 38 | ## TODO: 39 | 40 | 1. Use `argparse` to get specific instructions 41 | 2. Add the wallpaper to Ubuntu's default Unity wallpaper manager 42 | 43 | ## Contact Me: 44 | 45 | [twitter](https://twitter.com/anshulxyz) 46 | [GitHub](https://github.com/anshulxyz) 47 | 48 | 49 | ## Release notes 50 | ### 1.1.0 51 | 52 | I have replaced the *pygame* with *PIL(Python Image Library)* since it's better 53 | maintained and is focused specially on image manipulation, thus giving me more 54 | things to try with images. 55 | 56 | I have faded the colours, tried to mute them down. By mixing them with the 'white' 57 | colour, and then taking a average of them. 58 | 59 | I have removed the feature of script setting the wallpaper for you, I realised 60 | people have different application according to their taste which they use for 61 | customizing their desktop, so setting wallpaper, I leave that to you. 62 | 63 | You can find previous releases [here](https://github.com/anshulc95/rangeela/releases) 64 | -------------------------------------------------------------------------------- /pic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anshulxyz/rangeela/b78172d9008d4fcbc3a6f456059d82bd55b9a91c/pic.png -------------------------------------------------------------------------------- /rangeela.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageDraw 2 | import random 3 | import gtk 4 | 5 | # reading screen resolution 6 | screen_width = gtk.gdk.screen_width() 7 | screen_height = gtk.gdk.screen_height() 8 | 9 | # create new image 10 | image = Image.new("RGB",(screen_width, screen_height), "white") 11 | 12 | # square size 13 | square_size = (20, 20) 14 | 15 | # open up the image for manipulation 16 | draw = ImageDraw.Draw(image, mode="RGB") 17 | 18 | for i in range(0, screen_width+square_size[0], square_size[0]): 19 | for j in range(0, screen_height+square_size[1], square_size[1]): 20 | colours = [random.randint(0,255) for _ in range(3)] 21 | red = (colours[0]+255)/2 22 | green = (colours[1]+255)/2 23 | blue = (colours[2]+255)/2 24 | draw.rectangle( (i,j,20+i,20+j), fill=(red,green,blue) ) 25 | 26 | # write to STDOUT 27 | image.save("pic.png") 28 | --------------------------------------------------------------------------------