Talk:Colors

Code Review
I've looked at this and I have a few of questions/notes: Lunarity 19:41, November 3, 2012 (UTC)
 * You're adding a "getStyle" function to jQuery. What is the reason for that?  already returns the computed style. The function also does not handle the case where the jQuery is empty.
 * Sourcing the border from the top of the page is unreliable. The wiki's local sheet may disable the border entirely, you're going to have to check every page edge, the rail modules, and the DIVs in the footer. Then there's edit pages. It'd be more reliable to calculate it the same way Wikia does from the page color.
 * You've reimplemented  instead of importing and using that. Is there a specific reason for that? It wouldn't complicate the interface much, just add a promise to dev.Colors then anyone using the script can do , the promise can be replaced with the real module when it's ready and the promise itself will resolve to the module object.
 * There aren't enough utility functions, you need:
 * saturate
 * rotateHue
 * blend
 * Your "isBright" disagrees with Wikia's, Wikia's uses >= 0.5.
 * Your "brighten" doesn't clamp negative values, if I brighten black by -0.1 then it'll go negative instead of clamping at zero.
 * You're memoizing but you aren't constraining the size of the cache.
 * There's no handling for rgba/hsla
 * This only works in Oasis, Monobook doesn't use SASS.
 * The stylesheet parser is too simple, it only substitutes predetermined values. For ReferencePopups, I need to desaturate and lighten the page color (dark wiki) or darken and blend (light wiki) [background color] and do something similar to come up with the border color, then substitute those values into a mini-sheet, not the raw SASS ones. [I'm also considering making the background into a faint striped gradient which will need a lot of these computations] I'd suggest taking a variable map and substituting arbitrary values:
 * IMHO, it would make more sense to provide an OOP API, define a Color class and stick the functions on that: