Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gorgeous Random Color Scheme Gradient Generator for Photoshop
// by Douglas Bonneville | bonfx.com
// http://bonfx.com/gorgeous-random-color-scheme-gradient-generator-for-photoshop
// preferences
app.preferences.rulerUnits = Units.PIXELS
// constants
var lenWidth = 500
var quad = lenWidth/2;
function randFactor() {
x = Math.random()*255;
return x;
}
tetrad1 = new RGBColor();
tetrad1.red = randFactor();
tetrad1.green = randFactor();
tetrad1.blue = randFactor();
tetrad2 = new RGBColor();
tetrad2.red = randFactor();
tetrad2.green = randFactor();
tetrad2.blue = randFactor();
tetrad3 = new RGBColor();
tetrad3.red = randFactor();
tetrad3.green = randFactor();
tetrad3.blue = randFactor();
tetrad4 = new RGBColor();
tetrad4.red = randFactor();
tetrad4.green = randFactor();
tetrad4.blue = randFactor();
// create new doc
app.documents.add (lenWidth, lenWidth, 72);
// make 4 squares
app.activeDocument.selection.select([[0,0],[0,quad],[quad,quad],[quad,0]]);
app.activeDocument.selection.fill( tetrad1);
app.activeDocument.selection.translateBoundary(quad, 0);
app.activeDocument.selection.fill( tetrad2);
app.activeDocument.selection.translateBoundary(0, quad);
app.activeDocument.selection.fill( tetrad3);
app.activeDocument.selection.translateBoundary(-quad, 0);
app.activeDocument.selection.fill( tetrad4);
app.activeDocument.selection.deselect();
// blur
app.activeDocument.activeLayer.applyGaussianBlur(120);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.