1. #1
    Sencha User demon222's Avatar
    Join Date
    Jan 2008
    Location
    Poland, Warsaw
    Posts
    124
    Vote Rating
    2
    demon222 is on a distinguished road

      0  

    Default Ext.util.Color

    Ext.util.Color


    simple color invert function

    use: Ext.util.Color.invertHex('ffffff') - > 000000

    PHP Code:
    Ext.util.Color = function() {
        return {
                    
    decToHex: function( ) {
                            var 
    HCHARS '0123456789ABCDEF';
                            
    parseInt(n10);
                            
    = ( !isNaN)) ? 0;
                            
    = (255 || 0) ? n;
                            return 
    HCHARS.charAt( ( 16 ) / 16 ) + HCHARS.charAt16 );
                    },
            
    getHCharPos: function( ) {
                var 
    HCHARS '0123456789ABCDEF';
                return 
    HCHARS.indexOfc.toUpperCase() );
            },
            
    hexToDec: function( hex ) {
                var 
    hex.split('');
                return ( ( 
    Ext.util.Color.getHCharPoss[0] ) * 16 ) + Ext.util.Color.getHCharPoss[1] ) );
            },
                    
    rgbToHex: function( rg) {
                            if( 
    instanceof Array ) { return Ext.util.Color.rgbToHex.callthisr[0], r[1], r[2] ); }
                            return 
    Ext.util.Color.decToHex) + Ext.util.Color.decToHex) + Ext.util.Color.decToHex);
                    },               
            
    hexToRgb: function( hex ) {
                return [ 
    Ext.util.Color.hexToDechex.substr(02) ), Ext.util.Color.hexToDechex.substr(22) ), Ext.util.Color.hexToDechex.substr(42) ) ];
            },
            
    invertRgb: function( rg) {
                if( 
    instanceof Array ) { return Ext.util.Color.invertRgb.callthisr[0], r[1], r[2] ); }
                return [
    255-r,255-g,255-b];
            },
                    
    invertHex: function( hex ) {
                        var 
    rgb Ext.util.Color.hexToRgb(hex),
                        
    invert =  Ext.util.Color.invertRgb(rgb[0], rgb[1], rgb[2]);
                        return 
    Ext.util.Color.rgbToHex(invert[0], invert[1], invert[2]);
                    }
        }
    }(); 

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,599
    Vote Rating
    434
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Nice!
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.