The Shape of Everything
A website mostly about Mac stuff, written by Gus Mueller
» Acorn
» Twitter
» Maybe Pizza?
» Code
» Archive
November 5, 2014

I wrote a quick little script for Acorn which takes the front and back colors, and averages the two together. It's pretty simple, and you can grab it off Acorn's GitHub repository.

I've been doing a bit of fiddly pixel work lately, and this has been coming in handy when blending between two different colors.

Here's the main bits of the script:

function main() {
    var tp = [NSApp toolPalette]
    var c = [[tp frontColor] blendedColorWithFraction:.5 ofColor:[tp backColor]];
    if (c) {
        [tp setFrontColor:c];
    }
}