1
0
Fork 0
mirror of synced 2024-09-28 23:31:43 +12:00

Add placholder color to color picker component to represent undefined color choice

This commit is contained in:
Andrew Kingston 2021-07-05 14:31:10 +01:00
parent a84d1d2ec8
commit 77ae0e58b8

View file

@ -13,7 +13,6 @@
let open = false
$: color = value || "transparent"
$: customValue = getCustomValue(value)
$: checkColor = getCheckColor(value)
@ -110,7 +109,11 @@
<div class="container">
<div class="preview size--{size || 'M'}" on:click={() => (open = true)}>
<div class="fill {spectrumTheme || ''}" style="background: {color};" />
<div
class="fill {spectrumTheme || ''}"
style={value ? `background: ${value};` : ""}
class:placeholder={!value}
/>
</div>
{#if open}
<div
@ -191,6 +194,26 @@
display: grid;
place-items: center;
}
.fill.placeholder {
background-position: 0 0, 10px 10px;
background-size: 20px 20px;
background-image: linear-gradient(
45deg,
#eee 25%,
transparent 25%,
transparent 75%,
#eee 75%,
#eee 100%
),
linear-gradient(
45deg,
#eee 25%,
white 25%,
white 75%,
#eee 75%,
#eee 100%
);
}
.size--S {
width: 20px;
height: 20px;