anki/ts/editor/WithColorHelper.svelte

28 lines
643 B
Svelte
Raw Normal View History

2021-05-30 21:44:05 +02:00
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="typescript">
import { colorHelperIcon } from "./icons";
export let color = "black";
2021-05-30 22:58:40 +02:00
function setColor({ currentTarget }: Event): void {
color = (currentTarget! as HTMLInputElement).value;
2021-05-30 21:44:05 +02:00
}
</script>
<div style={`--color-helper-color: ${color}`}>
<slot {colorHelperIcon} {color} {setColor} />
</div>
<style lang="scss">
2021-05-30 22:58:40 +02:00
div {
display: contents;
:global(#mdi-color-helper) {
fill: var(--color-helper-color);
}
2021-05-30 21:44:05 +02:00
}
</style>