mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-06-10 02:02:44 +00:00
add settings color input
This commit is contained in:
parent
c2b4d95070
commit
7ec7a88e98
2 changed files with 33 additions and 1 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
class ConfigMenu {
|
class ConfigMenu {
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} DribbblishConfigItem
|
* @typedef {Object} DribbblishConfigItem
|
||||||
* @property {"checkbox" | "select" | "button" | "slider" | "number" | "text" | "time"} type
|
* @property {"checkbox" | "select" | "button" | "slider" | "number" | "text" | "time" | "color"} type
|
||||||
* @property {String|DribbblishConfigArea} [area={name: "Main Settings", order: 0}]
|
* @property {String|DribbblishConfigArea} [area={name: "Main Settings", order: 0}]
|
||||||
* @property {any} [data={}]
|
* @property {any} [data={}]
|
||||||
* @property {Number} [order=0] order < 0 = Higher up | order > 0 = Lower Down
|
* @property {Number} [order=0] order < 0 = Higher up | order > 0 = Lower Down
|
||||||
|
|
@ -268,6 +268,18 @@ class ConfigMenu {
|
||||||
this.set(options.key, e.target.value);
|
this.set(options.key, e.target.value);
|
||||||
options.onChange(this.get(options.key));
|
options.onChange(this.get(options.key));
|
||||||
});
|
});
|
||||||
|
} else if (options.type == "color") {
|
||||||
|
// Validate
|
||||||
|
if (options.defaultValue == null) options.defaultValue = "#000000";
|
||||||
|
const input = /* html */ `
|
||||||
|
<input type="color" id="dribbblish-config-input-${options.key}" name="${options.name}" value="${this.get(options.key)}">
|
||||||
|
`;
|
||||||
|
this.addInputHTML({ ...options, input });
|
||||||
|
|
||||||
|
document.getElementById(`dribbblish-config-input-${options.key}`).addEventListener("input", (e) => {
|
||||||
|
this.set(options.key, e.target.value);
|
||||||
|
options.onChange(this.get(options.key));
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Config Type "${options.type}" invalid`);
|
throw new Error(`Config Type "${options.type}" invalid`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
user.css
20
user.css
|
|
@ -174,6 +174,26 @@ input[type="time"]::-webkit-calendar-picker-indicator {
|
||||||
filter: invert(calc(1 - var(--is_light)));
|
filter: invert(calc(1 - var(--is_light)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input[type=color] {
|
||||||
|
position: relative;
|
||||||
|
padding: 0px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=color]::before {
|
||||||
|
z-index: -1;
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: -5px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: rgba(var(--spice-rgb-selected-row), .4);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type=color]:hover::before,
|
||||||
|
input[type=color]:active::before {
|
||||||
|
background-color: rgba(var(--spice-rgb-selected-row), .6);
|
||||||
|
}
|
||||||
|
|
||||||
.x-searchInput-searchInputSearchIcon,
|
.x-searchInput-searchInputSearchIcon,
|
||||||
.x-searchInput-searchInputClearButton {
|
.x-searchInput-searchInputClearButton {
|
||||||
color: var(--spice-text) !important;
|
color: var(--spice-text) !important;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue