lib/carto/tree/color.js
function() {
        if (this.hsl !== null) {
            if (this.alpha < 1.0) {
                if (this.perceptual) {
                    return 'rgba(' + hsluv.hsluvToRgb([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]).map(function(c) {
                        return Math.round(c * 255);
                    }).concat(this.round(this.alpha, 2)).join(', ') + ')';
                }
                else {
                    return 'rgba(' + chroma.hsl(this.hsl[0], this.hsl[1], this.hsl[2]).rgb().map(function(c) {
                        return Math.round(c);
                    }).concat(this.round(this.alpha, 2)).join(', ') + ')';
                }
            } else {
                if (this.perceptual) {
                    return hsluv.hsluvToHex([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]);
                }
                else {
                    return chroma.hsl(this.hsl[0], this.hsl[1], this.hsl[2]).hex();
                }
            }
        }
        return '';
    }
function() {
        if (this.hsl !== null) {
            if (this.alpha < 1.0) {
                if (this.perceptual) {
                    return 'rgba(' + hsluv.hsluvToRgb([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]).map(function(c) {
                        return Math.round(c * 255);
                    }).concat(this.round(this.alpha, 2)).join(', ') + ')';
                }
                else {
                    return 'rgba(' + chroma.hsl(this.hsl[0], this.hsl[1], this.hsl[2]).rgb().map(function(c) {
                        return Math.round(c);
                    }).concat(this.round(this.alpha, 2)).join(', ') + ')';
                }
            } else {
                if (this.perceptual) {
                    return hsluv.hsluvToHex([this.hsl[0], this.hsl[1] * 100, this.hsl[2] * 100]);
                }
                else {
                    return chroma.hsl(this.hsl[0], this.hsl[1], this.hsl[2]).hex();
                }
            }
        }
        return '';
    }
function ( ) { if ( this . hsl !== null ) { if ( this . alpha < 1.0 ) { if ( this . perceptual ) { return 'rgba(' + hsluv . hsluvToRgb ( [ this . hsl [ 0 ] , this . hsl [ 1 ] * 100 , this . hsl [ 2 ] * 100 ] ) . map ( function ( c ) { return Math . round ( c * 255 ) ; } ) . concat ( this . round ( this . alpha , 2 ) ) . join ( ', ' ) + ')' ; } else { return 'rgba(' + chroma . hsl ( this . hsl [ 0 ] , this . hsl [ 1 ] , this . hsl [ 2 ] ) . rgb ( ) . map ( function ( c ) { return Math . round ( c ) ; } ) . concat ( this . round ( this . alpha , 2 ) ) . join ( ', ' ) + ')' ; } } else { if ( this . perceptual ) { return hsluv . hsluvToHex ( [ this . hsl [ 0 ] , this . hsl [ 1 ] * 100 , this . hsl [ 2 ] * 100 ] ) ; } else { return chroma . hsl ( this . hsl [ 0 ] , this . hsl [ 1 ] , this . hsl [ 2 ] ) . hex ( ) ; } } } return '' ; }
If we have some transparency, the only way to represent it is via `rgba`. Otherwise, we use the hex representation, which has better compatibility with older browsers.
If we have some transparency the only way to represent it is via rgba . Otherwise we use the hex representation which has better compatibility with older browsers .