(function(paw){
    function ColorUtils(){

    }
    
    // Function to convert RGB to Hex color
    ColorUtils.prototype.rgbToARGB = function(rgbColor) {
        // Convert RGB color string (e.g., 'rgb(255, 0, 0)') to Hex format
        const match = /rgb\((\d+), (\d+), (\d+)\)/.exec(rgbColor);
        if (match) {
            const r = parseInt(match[1]);
            const g = parseInt(match[2]);
            const b = parseInt(match[3]);
            return this.rgbaToARGB('rgba(' + r + ', ' + g + ', ' + b + ', 255)');
        }
        return null;
    };
    
    // Function to convert RGBA to Hex color
    ColorUtils.prototype.rgbaToARGB = function(color) {
        if(!this.isRgb(color)){
            return this.rgbToARGB(color);
        }

        // Convert RGB color string (e.g., 'rgb(255, 0, 0, 1)') to Hex format
        const match = /rgba\((\d+), (\d+), (\d+), (\d+)\)/.exec(color);
        if (match) {
            const r = parseInt(match[1]);
            const g = parseInt(match[2]);
            const b = parseInt(match[3]);
            const a = parseInt(match[4]);
            return this.rgbToHexComponent(a) + this.rgbToHexComponent(r) + this.rgbToHexComponent(g) + this.rgbToHexComponent(b);
        }
        return null;
    };

    // Helper function to convert RGB component to Hex
    ColorUtils.prototype.rgbToHexComponent = function(c) {
        const hex = c.toString(16);
        return hex.length == 1 ? '0' + hex : hex;
    };

    ColorUtils.prototype.isRgba = function(value){
        return value.indexOf('rgba(') > -1;
    };

    ColorUtils.prototype.isRgb = function(value){
        return value.indexOf('rgba(') > -1;
    };

    paw.utils.color = new ColorUtils();
})(paw);