Giter Site home page Giter Site logo

Does it work with input tag? about alwan HOT 7 CLOSED

Jonnas123 avatar Jonnas123 commented on September 16, 2024
Does it work with input tag?

from alwan.

Comments (7)

sefianecho avatar sefianecho commented on September 16, 2024

That's because the option preset is set to true by default (preset button), change it to false to keep the input.

const alwan = new Alwan('#colorpicker', {
    preset: false
});

from alwan.

Jonnas123 avatar Jonnas123 commented on September 16, 2024

Now the picker shows up after using the preset: flase. However, I don't know why it doesn't apply to Fabric js's text. But I try this picker Coloris it works.

from alwan.

sefianecho avatar sefianecho commented on September 16, 2024

You need to set the value of the input.

Example:

const input = document.getElementById('colorpicker');
alwan.on('color', e => {
     input.value = e.rgb;
});

from alwan.

Jonnas123 avatar Jonnas123 commented on September 16, 2024

Sorry, my misunderstanding. This one works for me. With or without preset: false, still work.

const alwan = new Alwan('#colorpicker', {

});

const input = document.getElementById('colorpicker');
   alwan.on('color', e => {
   input.style.color = e.rgb;
   canvas.getActiveObject().set("fill",input.style.color);
   canvas.renderAll();
   });

from alwan.

sefianecho avatar sefianecho commented on September 16, 2024

You don't need an input, you can set the fill color directly from the color picker.

alwan.on('color', e => {
     canvas.getActiveObject().set("fill", e.rgb);
     canvas.renderAll();
 });

from alwan.

Jonnas123 avatar Jonnas123 commented on September 16, 2024

But if have many Ids to apply, still need, right?

from alwan.

sefianecho avatar sefianecho commented on September 16, 2024

Depends on your code.

from alwan.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.