|
|
@ -1,6 +1,7 @@ |
|
|
<script> |
|
|
<script> |
|
|
import { onMount, createEventDispatcher } from "svelte"; |
|
|
import { onMount, createEventDispatcher } from "svelte"; |
|
|
|
|
|
import CheckedBackground from "./CheckedBackground.svelte" |
|
|
|
|
|
import {buildStyle} from "./helpers.js" |
|
|
import { |
|
|
import { |
|
|
getColorFormat, |
|
|
getColorFormat, |
|
|
convertToHSVA, |
|
|
convertToHSVA, |
|
|
@ -59,7 +60,6 @@ |
|
|
|
|
|
|
|
|
function changeFormatAndConvert(f) { |
|
|
function changeFormatAndConvert(f) { |
|
|
format = f; |
|
|
format = f; |
|
|
console.log(f) |
|
|
|
|
|
value = convertHsvaToFormat([h, s, v, a], format); |
|
|
value = convertHsvaToFormat([h, s, v, a], format); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -73,6 +73,8 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$: border = s < 10 ? "1px dashed #dedada" : "" |
|
|
|
|
|
$: style = buildStyle({background: value, border}) |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |
|
|
@ -81,19 +83,25 @@ |
|
|
font-size: 11px; |
|
|
font-size: 11px; |
|
|
font-weight: 400; |
|
|
font-weight: 400; |
|
|
flex-direction: column; |
|
|
flex-direction: column; |
|
|
height: 300px; |
|
|
height: 265px; |
|
|
width: 250px; |
|
|
width: 220px; |
|
|
background: #ffffff; |
|
|
background: #ffffff; |
|
|
border-radius: 2px; |
|
|
border-radius: 2px; |
|
|
box-shadow: 0 0.15em 1.5em 0 rgba(0,0,0,.1), 0 0 1em 0 rgba(0,0,0,.03); |
|
|
box-shadow: 0 0.15em 1.5em 0 rgba(0,0,0,.1), 0 0 1em 0 rgba(0,0,0,.03); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.palette-panel { |
|
|
|
|
|
flex: 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.control-panel { |
|
|
.control-panel { |
|
|
|
|
|
flex: 1; |
|
|
display: flex; |
|
|
display: flex; |
|
|
flex-direction: column; |
|
|
flex-direction: column; |
|
|
padding: 8px; |
|
|
padding: 8px; |
|
|
background: white; |
|
|
background: white; |
|
|
border: 1px solid #d2d2d2 |
|
|
border: 1px solid #d2d2d2; |
|
|
|
|
|
color: #777373; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.alpha-hue-panel { |
|
|
.alpha-hue-panel { |
|
|
@ -108,7 +116,6 @@ |
|
|
width: 30px; |
|
|
width: 30px; |
|
|
height: 30px; |
|
|
height: 30px; |
|
|
border-radius: 50%; |
|
|
border-radius: 50%; |
|
|
border: 1px solid #dedada; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.format-input-panel { |
|
|
.format-input-panel { |
|
|
@ -120,19 +127,27 @@ |
|
|
|
|
|
|
|
|
<div class="colorpicker-container"> |
|
|
<div class="colorpicker-container"> |
|
|
|
|
|
|
|
|
<Palette on:change={setSaturationAndValue} {h} {s} {v} {a} /> |
|
|
<div class="palette-panel"> |
|
|
|
|
|
<Palette on:change={setSaturationAndValue} {h} {s} {v} {a} /> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="control-panel"> |
|
|
<div class="control-panel"> |
|
|
<div class="alpha-hue-panel"> |
|
|
<div class="alpha-hue-panel"> |
|
|
<div> |
|
|
<div> |
|
|
<div class="selected-color" style={`background: ${value}`} /> |
|
|
<CheckedBackground borderRadius="50%" backgroundSize="8px"> |
|
|
|
|
|
<div class="selected-color" {style} /> |
|
|
|
|
|
</CheckedBackground> |
|
|
</div> |
|
|
</div> |
|
|
<div> |
|
|
<div> |
|
|
<Slider type="hue" value={h} on:change={hue => setHue(hue.detail)} /> |
|
|
<Slider type="hue" value={h} on:change={hue => setHue(hue.detail)} /> |
|
|
<Slider |
|
|
|
|
|
type="alpha" |
|
|
<CheckedBackground borderRadius="10px" backgroundSize="7px"> |
|
|
value={a} |
|
|
<Slider |
|
|
on:change={alpha => setAlpha(alpha.detail)} /> |
|
|
type="alpha" |
|
|
|
|
|
value={a} |
|
|
|
|
|
on:change={alpha => setAlpha(alpha.detail)} /> |
|
|
|
|
|
</CheckedBackground> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|