Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How i can change the color of a div ? #65

Open
ivan-vilches opened this issue Jul 14, 2019 · 0 comments
Open

How i can change the color of a div ? #65

ivan-vilches opened this issue Jul 14, 2019 · 0 comments

Comments

@ivan-vilches
Copy link

I am using the code below , and i have a div with id="mybox" how i can change the color background of this div? thanks you

<script type="text/javascript"> // let elm = document.getElementById('box'); var memoryColors = [{ r: 100, g: 200, b: 10, a: 0.6 }, { r: 80, g: 100, b: 50, a: 0.9 }, { r: 70, g: 80, b: 10, a: 0.9 }, { r: 20, g: 200, b: 60, a: 0.9 }, { r: 88, g: 0, b: 30, a: 0.4 }, { r: 100, g: 0, b: 100, a: 0.6 }, { r: 200, g: 0, b: 0 }, { r: 200, g: 30, b: 100 }], $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'; }, draggable: true, 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 // }) }); </script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant