kolor.js
function RGBA_TO_HSVA() {
        var r = this.r() / 255;
        var g = this.g() / 255;
        var b = this.b() / 255;
        var a = this.a();
        var max = Math.max(r, g, b);
        var min = Math.min(r, g, b);
        var diff = max - min;
        var h;
        var s;

        if (max === min) {
            h = 0;
        } else if (max === r && g >= b) {
            h = 60 * (g - b) / diff + 0;
        } else if (max === r && g < b) {
            h = 60 * (g - b) / diff + 360;
        } else if (max === g) {
            h = 60 * (b - r) / diff + 120;
        } else { // max === b
            h = 60 * (r - g) / diff + 240;
        }

        if (max === 0) {
            s = 0;
        } else {
            s = diff / max;
        }

        var v = max;
        return kolor.hsva(h, s, v, a);
    }
function RGBA_TO_HSVA() {
        var r = this.r() / 255;
        var g = this.g() / 255;
        var b = this.b() / 255;
        var a = this.a();
        var max = Math.max(r, g, b);
        var min = Math.min(r, g, b);
        var diff = max - min;
        var h;
        var s;

        if (max === min) {
            h = 0;
        } else if (max === r && g >= b) {
            h = 60 * (g - b) / diff + 0;
        } else if (max === r && g < b) {
            h = 60 * (g - b) / diff + 360;
        } else if (max === g) {
            h = 60 * (b - r) / diff + 120;
        } else { // max === b
            h = 60 * (r - g) / diff + 240;
        }

        if (max === 0) {
            s = 0;
        } else {
            s = diff / max;
        }

        var v = max;
        return kolor.hsva(h, s, v, a);
    }
function RGBA_TO_HSVA ( ) { var r = this . r ( ) / 255 ; var g = this . g ( ) / 255 ; var b = this . b ( ) / 255 ; var a = this . a ( ) ; var max = Math . max ( r , g , b ) ; var min = Math . min ( r , g , b ) ; var diff = max - min ; var h ; var s ; if ( max === min ) { h = 0 ; } else if ( max === r && g >= b ) { h = 60 * ( g - b ) / diff + 0 ; } else if ( max === r && g < b ) { h = 60 * ( g - b ) / diff + 360 ; } else if ( max === g ) { h = 60 * ( b - r ) / diff + 120 ; } else { // max === b
 h = 60 * ( r - g ) / diff + 240 ; } if ( max === 0 ) { s = 0 ; } else { s = diff / max ; } var v = max ; return kolor . hsva ( h , s , v , a ) ; }
Converts RGBA color to HSVA.
Converts RGBA color to HSVA .