anki/ts/editor-toolbar/ColorPicker.svelte

54 lines
1.1 KiB
Svelte
Raw Normal View History

<script lang="typescript">
export let id = "";
export let className = "";
export let props: Record<string, string> = {};
export let title: string;
export let onChange: (event: ChangeEvent) => void;
</script>
<style lang="scss">
2021-03-29 21:05:30 +02:00
button {
display: inline-block;
2021-03-29 21:05:30 +02:00
padding: 0;
&:hover {
background-color: #eee;
}
2021-03-30 03:17:36 +02:00
&:active {
box-shadow: inset 0 0 calc(var(--toolbar-size) / 2.5)
calc(var(--toolbar-size) / 7.5) rgb(0 0 0 / 30%);
border-color: #aaa;
2021-03-30 03:17:36 +02:00
}
2021-03-29 21:05:30 +02:00
}
span {
display: inline-block;
vertical-align: middle;
2021-03-29 21:05:30 +02:00
width: 100%;
height: 100%;
cursor: pointer;
}
input {
display: inline-block;
opacity: 0;
width: calc(var(--toolbar-size) - 6px);
height: calc(var(--toolbar-size) - 6px);
cursor: pointer;
}
</style>
<button
tabindex="-1"
{id}
class={className}
{...props}
{title}
on:mousedown|preventDefault>
<span> <input type="color" on:change={onChange} /> </span>
2021-03-30 00:51:44 +02:00
</button>