├── colorcomb.png ├── README.md └── ColorCombinations.py /colorcomb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ninastoessinger/DrawBot-Scripts/HEAD/colorcomb.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DrawBot-Scripts 2 | 3 | Various Python scripts to be run in [DrawBot](http://drawbot.readthedocs.org/). 4 | 5 | **ColorCombinations.py** 6 | Takes a list of RGB colors and displays a grid of all possible combinations between them, handy for designing color schemes. 7 | ![ColorCombinations Screenshot](/colorcomb.png) 8 | -------------------------------------------------------------------------------- /ColorCombinations.py: -------------------------------------------------------------------------------- 1 | """ 2 | ColorCombinations.py 3 | 4 | Simple DrawBot script to show all possible combinations of color swatches for a given list of colors. 5 | """ 6 | 7 | # set a color space to finetune display of colors 8 | # requires DrawBot version 3.55 and up 9 | # use listColorSpaces() to see what's available 10 | colorspace = "sRGB" 11 | 12 | # define colors as r,g,b values 13 | colorsRGB = [ 14 | (0,0,0), 15 | (71,88,56), 16 | (159,184,173), 17 | (255,236,68), 18 | (255,185,32), 19 | (206,208,206), 20 | (232,232,230), 21 | (161,135,120), 22 | (50,26,20), 23 | ] 24 | colors = [(r/255, g/255, b/255) for (r,g,b) in colorsRGB] 25 | 26 | # dimensions of color double-swatches 27 | swatchHeight = 40 28 | swatchWidth = 40 29 | 30 | # space between color swatches 31 | padding = 10 32 | 33 | # end of editable parameters 34 | 35 | 36 | spaceX = swatchWidth + padding 37 | spaceY = swatchHeight + padding*1.025 38 | startX = (595 - ((len(colors)+1)*spaceX + swatchWidth))/2 # center horizontally 39 | startY = 750 40 | 41 | 42 | newPage('A4') 43 | colorSpace(colorspace) 44 | translate(startX,startY) 45 | for c1 in colors: 46 | r1, g1, b1 = c1 47 | for c2 in colors: 48 | translate(spaceX,0) 49 | if c1 != c2: 50 | r2, g2, b2 = c2 51 | stroke(None) 52 | fill(r1,g1,b1) 53 | rect(0, 0, swatchWidth/2, swatchHeight) 54 | fill(r2,g2,b2) 55 | rect(swatchWidth/2, 0, swatchWidth/2, swatchHeight) 56 | else: 57 | stroke(0) 58 | strokeWidth(3) 59 | fill(r1,g1,b1) 60 | rect(0, 0, swatchWidth, swatchHeight) 61 | translate(-(len(colors) * spaceX),-spaceY) 62 | --------------------------------------------------------------------------------