Comments (7)
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.
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.
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.
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.
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.
But if have many Ids to apply, still need, right?
from alwan.
Depends on your code.
from alwan.
Related Issues (14)
- Uncaught TypeError: Cannot convert undefined or null to object HOT 1
- No close event fired HOT 1
- error when pick color on 1.1.2 version plugin HOT 5
- Trouble building this with my Webpack config HOT 3
- Cannot copy color HOT 1
- Add support for labels in swatches HOT 1
- Check if the colors are picked and then enable a button HOT 4
- `destroy()` method removes reference element when `preset` option is `false` HOT 1
- When there is a dialog element, the color picker box displays behind it HOT 3
- Transparent input when initial color is black and opacity is false
- How to use a shadow DOM element as the reference element? HOT 5
- 2.1.1 not tagged?
- Link for Demo page inside Readme file is wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alwan.