dispatch("click")}}
in:fade
class="swatch"
style={`background: ${color};`}
@@ -38,6 +41,8 @@
border: 1px solid #dedada;
height: 20px;
width: 20px;
+ outline-color: #003cb0;
+ outline-width: thin;
}
.space {
diff --git a/packages/builder/src/components/userInterface/Colorpicker/helpers.js b/packages/builder/src/components/userInterface/Colorpicker/helpers.js
index 5d9ff750af..bd4d666bc1 100644
--- a/packages/builder/src/components/userInterface/Colorpicker/helpers.js
+++ b/packages/builder/src/components/userInterface/Colorpicker/helpers.js
@@ -1,4 +1,4 @@
-export const buildStyle = styles => {
+export function buildStyle(styles) {
let str = ""
for (let s in styles) {
if (styles[s]) {
@@ -12,3 +12,9 @@ export const buildStyle = styles => {
export const convertCamel = str => {
return str.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)
}
+
+export const debounce = (fn, milliseconds) => {
+ return () => {
+ setTimeout(fn, milliseconds)
+ }
+}
diff --git a/packages/builder/src/components/userInterface/Colorpicker/index.js b/packages/builder/src/components/userInterface/Colorpicker/index.js
index 21e19acc9b..80a44b8a85 100644
--- a/packages/builder/src/components/userInterface/Colorpicker/index.js
+++ b/packages/builder/src/components/userInterface/Colorpicker/index.js
@@ -1,2 +1,2 @@
-import Colorpreview from "./Colorpreview.svelte"
+import Colorpreview from "./components/Colorpreview.svelte"
export default Colorpreview
diff --git a/packages/builder/src/components/userInterface/Colorpicker/utils.js b/packages/builder/src/components/userInterface/Colorpicker/utils.js
index e14c8711ab..6049046e60 100644
--- a/packages/builder/src/components/userInterface/Colorpicker/utils.js
+++ b/packages/builder/src/components/userInterface/Colorpicker/utils.js
@@ -144,13 +144,15 @@ export const hslaToHSVA = ([h, s, l, a = 1]) => {
export const hsvaToHexa = (hsva, asString = false) => {
const [r, g, b, a] = hsvaToRgba(hsva)
+ const padSingle = hex => (hex.length === 1 ? `0${hex}` : hex)
- const hexa = [r, g, b]
- .map(v => {
- let hex = Math.round(v).toString(16)
- return hex.length === 1 ? `0${hex}` : hex
- })
- .concat(Math.round(a * 255).toString(16))
+ let hexa = [r, g, b].map(v => {
+ let hex = Math.round(v).toString(16)
+ return padSingle(hex)
+ })
+
+ let alpha = padSingle(Math.round(a * 255).toString(16))
+ hexa = [...hexa, alpha]
return asString ? `#${hexa.join("")}` : hexa
}
diff --git a/packages/builder/src/components/userInterface/Colorpicker/utils.test.js b/packages/builder/src/components/userInterface/Colorpicker/utils.test.js
index c47d54ed1b..e86be71885 100644
--- a/packages/builder/src/components/userInterface/Colorpicker/utils.test.js
+++ b/packages/builder/src/components/userInterface/Colorpicker/utils.test.js
@@ -1,4 +1,4 @@
-import { getColorFormat, convertToHSVA, convertHsvaToFormat } from "./utils"
+import { getColorFormat, convertToHSVA, convertHsvaToFormat } from "./../utils"
describe("convertToHSVA - convert to hsva from format", () => {
test("convert from hexa", () => {
diff --git a/packages/builder/src/components/userInterface/propertyCategories.js b/packages/builder/src/components/userInterface/propertyCategories.js
index d3605210e9..9824c846d6 100644
--- a/packages/builder/src/components/userInterface/propertyCategories.js
+++ b/packages/builder/src/components/userInterface/propertyCategories.js
@@ -395,6 +395,7 @@ export const typography = [
label: "Color",
key: "color",
control: Colorpicker,
+ swatches: ["#fff", "#000", "#111", "#ccc", "ede"],
defaultValue: "#000",
},
{