Add random color method
This commit is contained in:
parent
1dd10a2044
commit
8c26fe50e3
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tp/tp-color-picker",
|
"name": "@tp/tp-color-picker",
|
||||||
"version": "1.0.1",
|
"version": "1.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "tp-color-picker.js",
|
"main": "tp-color-picker.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -124,6 +124,12 @@ class TpColorPicker extends FormElement(DomQuery(LitElement)) {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
randomColor() {
|
||||||
|
const randomColor = this.colorList[Math.floor(Math.random() * this.colorList.length)];
|
||||||
|
this.value = randomColor;
|
||||||
|
return randomColor;
|
||||||
|
}
|
||||||
|
|
||||||
_selectColor(e) {
|
_selectColor(e) {
|
||||||
const target = e.composedPath()[0];
|
const target = e.composedPath()[0];
|
||||||
if (target.hasAttribute('color')) {
|
if (target.hasAttribute('color')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user