Categories

ep.Colorpicker()

Categories: Color | Utilities

new ep.Colorpicker( [ options ] )

Plugin: ep.colorpicker

Description: Create a canvas color picker.

  • new ep.Colorpicker( [ options ] )

    version added: 6.12.0

    options   A map of additional options pass to the method.

Create a <canvas> color picker.

The .elem property of an instance is the main element of the color picker. Use .elem to append the color picker to any DOM element.

  • Create a color picker and change body background on select color.

    Code:
    var picker = new ep.Colorpicker({
            hex: '#330099',
            callback: function( color ){
                $('body').css( 'background-color', '#'+color );
            }
        });
    
    $('body').append(picker.elem);
    
    
  • hex

    version added: 6.12.0

    A hex formated startup color.

    Default: \'#ffffff\'

  • size

    version added: 6.12.0

    Size of the main color select field.

    Default: 200

  • margin

    version added: 6.12.0

    Margin around the color select fields.

    Default: 10

  • callback( color )

    version added: 6.12.0

    A function to be called after each step of the color selection. Receives the selected color as argument.