kolor.js
function parseNamedHues(value) {
        var tokens = value.split(/\s+/);
        var l = tokens.length;

        if (l < 1 || l > 2) {
            return false;
        }

        var t1 = tokens[l - 1].toLowerCase();

        if (!(t1 in BASE_HUE)) {
            return false;
        }

        var h1 = BASE_HUE[t1];

        // single-value syntax
        if (l === 1) {
            return h1;
        }

        // double-value syntax
        var h2;
        var t2 = tokens[0].toLowerCase();
        var hues;
        if (t2 in BASE_HUE) {
            h2 = BASE_HUE[t2];
            hues = fixHues(h1, h2);
            return hues ? (hues.h1 + hues.h2) / 2 : false;
        } else if (t2 in SPLASH_HUE) {
            h2 = SPLASH_HUE[t2];
            hues = fixHues(h1, h2);
            return hues ? (hues.h1 + (hues.h2 - hues.h1) / 4) : false;
        } else {
            var found = t2.match(/(\w+)\(\s*([^\)]+)\s*\)/i);
            if (!found) {
                return false;
            }
            t2 = found[1];
            if (t2 in SPLASH_HUE) {
                h2 = SPLASH_HUE[t2];
                hues = fixHues(h1, h2);
                var percent = DATATYPES[PERCENT].parse(found[2]);
                if (percent === false) {
                    return percent;
                }
                return hues ? (hues.h1 + (hues.h2 - hues.h1) * percent) : false;
            }
        }

        return false;
    }
function parseNamedHues(value) {
        var tokens = value.split(/\s+/);
        var l = tokens.length;

        if (l < 1 || l > 2) {
            return false;
        }

        var t1 = tokens[l - 1].toLowerCase();

        if (!(t1 in BASE_HUE)) {
            return false;
        }

        var h1 = BASE_HUE[t1];

        // single-value syntax
        if (l === 1) {
            return h1;
        }

        // double-value syntax
        var h2;
        var t2 = tokens[0].toLowerCase();
        var hues;
        if (t2 in BASE_HUE) {
            h2 = BASE_HUE[t2];
            hues = fixHues(h1, h2);
            return hues ? (hues.h1 + hues.h2) / 2 : false;
        } else if (t2 in SPLASH_HUE) {
            h2 = SPLASH_HUE[t2];
            hues = fixHues(h1, h2);
            return hues ? (hues.h1 + (hues.h2 - hues.h1) / 4) : false;
        } else {
            var found = t2.match(/(\w+)\(\s*([^\)]+)\s*\)/i);
            if (!found) {
                return false;
            }
            t2 = found[1];
            if (t2 in SPLASH_HUE) {
                h2 = SPLASH_HUE[t2];
                hues = fixHues(h1, h2);
                var percent = DATATYPES[PERCENT].parse(found[2]);
                if (percent === false) {
                    return percent;
                }
                return hues ? (hues.h1 + (hues.h2 - hues.h1) * percent) : false;
            }
        }

        return false;
    }
function parseNamedHues ( value ) { var tokens = value . split ( / \s+ / ) ; var l = tokens . length ; if ( l < 1 || l > 2 ) { return false ; } var t1 = tokens [ l - 1 ] . toLowerCase ( ) ; if ( ! ( t1 in BASE_HUE ) ) { return false ; } var h1 = BASE_HUE [ t1 ] ; // single-value syntax
 if ( l === 1 ) { return h1 ; } // double-value syntax
 var h2 ; var t2 = tokens [ 0 ] . toLowerCase ( ) ; var hues ; if ( t2 in BASE_HUE ) { h2 = BASE_HUE [ t2 ] ; hues = fixHues ( h1 , h2 ) ; return hues ? ( hues . h1 + hues . h2 ) / 2 : false ; } else if ( t2 in SPLASH_HUE ) { h2 = SPLASH_HUE [ t2 ] ; hues = fixHues ( h1 , h2 ) ; return hues ? ( hues . h1 + ( hues . h2 - hues . h1 ) / 4 ) : false ; } else { var found = t2 . match ( / (\w+)\(\s*([^\)]+)\s*\) / i ) ; if ( ! found ) { return false ; } t2 = found [ 1 ] ; if ( t2 in SPLASH_HUE ) { h2 = SPLASH_HUE [ t2 ] ; hues = fixHues ( h1 , h2 ) ; var percent = DATATYPES [ PERCENT ] . parse ( found [ 2 ] ) ; if ( percent === false ) { return percent ; } return hues ? ( hues . h1 + ( hues . h2 - hues . h1 ) * percent ) : false ; } } return false ; }
Parses simple named hues
Parses simple named hues