Created
November 6, 2012 17:27
-
-
Save mattparker/4026185 to your computer and use it in GitHub Desktop.
idea for kb refactor of Y.Color.Harmony
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
/** | |
Generates a series of colors from startColor at various offsets | |
@protected | |
@method _getOffsetAndFinish | |
@param {String} startColor Start color | |
@param {Array} arrOffsets Array of colors | |
@param {String} [to] | |
@returns {Array} Of offsetted and finished colors | |
**/ | |
_getOffsetAndFinish: function (startColor, arrOffsets, to) { | |
var ret = [], | |
i = 0, | |
c0 = Harmony._start(startColor), | |
to = to || Color.findType(startColor); | |
for (;i < arrOffsets.length; i = i + 1) { | |
ret.push(Harmony.finish(Harmony.getOffset(c0, {h: arrOffset[i]})), to); | |
} | |
return ret; | |
} | |
// so something like getTriad becomes something like | |
// ie quite a lot smaller kb wise | |
getTriad: function (str, to) { | |
return Harmony._getOffsetAndFinish(str, [0, TRIAD_OFFSET, -TRIAD_OFFSET], to); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment