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

Support webcomponents #26

Open
suexID opened this issue Jul 30, 2015 · 1 comment
Open

Support webcomponents #26

suexID opened this issue Jul 30, 2015 · 1 comment

Comments

@suexID
Copy link

suexID commented Jul 30, 2015

Hi,

I've been searching for a simple, lightweight color picker written in vanilla javascript for ages and gladly I've found your colorPicker. However, no matter how hard I try I can't initalize your color picker on inputs wrapped in Google Polymer components. No errors, no output on the console.

Would you please guide me on how to bind the colorPicker to inputs in components if there's a way to do that?

@7Ds7
Copy link

7Ds7 commented Sep 6, 2016

This seems to be the best color picker around for vanilla JS so many thanks to @PitPik.
Sadly there is no web component version and it can not be used as such in a shadow dom environment as it relies on document.querySelectorAll and from there it searches the selector passed to the config.

From the documentation i did not see any other way to pass in for example a node list.

Although it can be used with Polymer as is with a few tweaks @suexID i made a small fork in which i pass in the context (ex: initialising the picker from within a component )

Now from within a component i pass in the context (ctx) for jsColor to find nodes from as document.querySelectorAll would not previous find within the shadow dom.

var colors = jsColorPicker('input.color', {
                ctx: this.$.container,
                customBG: '#000',
                readOnly: true,
               ...

Even so you might be better off with using colors.js and colorPicker.js only, and use your own implementation within your component.

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

2 participants