Skip to content

How to access colorPicker object? #57

@johnmastri

Description

@johnmastri

From your jQuery example:

$myColorPicker = $('input.color').colorPicker({
		customBG: '#222',
		readOnly: true,
		init: function(elm, colors) { // colors is a different instance (not connected to colorPicker)
			elm.style.backgroundColor = elm.value;
			elm.style.color = colors.rgbaMixCustom.luminance > 0.22 ? '#222' : '#ddd';
		},
		// appendTo: document.querySelector('.the-paragraph')
		// renderCallback: function(colors, mode) {
		// 	console.log(mode);
		// }
		// memoryColors: memoryColors,
		// actionCallback: function(event, type) {
		// 	if (type === 'toMemory') {
		// 		// $myColorPicker.renderMemory(memoryColors);
		// 	}
		// }
	}).each(function(idx, elm) {
		// $(elm).css({'background-color': this.value})
	});

I would think doing console.log($myColorPicker) would return the instance of the colorPicker - but it is returning an array. How do I access the colorPicker object (so I can access it's methods, setColor, etc..)?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions