Last active
August 29, 2015 19:55
-
-
Save serhei/38062 to your computer and use it in GitHub Desktop.
relatively less hideous kuler-based desktop background (rectangular subdivisions)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Hooray! A desktop background that doesn't burn your eyes out! | |
| # For Nodebox; requires the Web plugin to get colours off kuler. | |
| ximport ("web") | |
| # O Christmas Tree, taken off kuler | |
| colors, themes = [], web.kuler.search_by_id (115618) | |
| for r, g, b in themes[0]: | |
| colors += [color (r, g, b)] | |
| size (1680, 1050) | |
| phi = 1.68 | |
| nostroke () | |
| def subdivide (x, y, w, h, d): | |
| if d > 8 or random () < 0.5 and d > 4: | |
| fill (choice (colors)) | |
| rect (x, y, w, h) | |
| elif random () < 0.5: # divide horizontally | |
| v = choice ([w / phi, w - w / phi]) | |
| subdivide (x, y, v, h, d+1) | |
| subdivide (x+v-1, y, w-v+1, h, d+1) # +1/-1 eliminates gray lines between boxes | |
| else: # divide vertically | |
| v = choice ([h / phi, h - h / phi]) | |
| subdivide (x, y, w, v, d+1) | |
| subdivide (x, y+v-1, w, h-v+1, d+1) # +1/-1 eliminates gray lines between boxes | |
| subdivide (0, 0, WIDTH, HEIGHT, 0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment