Add placholder color to color picker component to represent undefined color choice
This commit is contained in:
parent
698e31acbc
commit
8ddf07b68a
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
let open = false
|
let open = false
|
||||||
|
|
||||||
$: color = value || "transparent"
|
|
||||||
$: customValue = getCustomValue(value)
|
$: customValue = getCustomValue(value)
|
||||||
$: checkColor = getCheckColor(value)
|
$: checkColor = getCheckColor(value)
|
||||||
|
|
||||||
|
@ -110,7 +109,11 @@
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="preview size--{size || 'M'}" on:click={() => (open = true)}>
|
<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>
|
</div>
|
||||||
{#if open}
|
{#if open}
|
||||||
<div
|
<div
|
||||||
|
@ -191,6 +194,26 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
place-items: center;
|
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 {
|
.size--S {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
Loading…
Reference in New Issue