anki/ts/editor/WithColorHelper.svelte

28 lines
644 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";
2021-06-19 16:31:35 +02:00
export let color: string;
2021-05-30 21:44:05 +02:00
function setColor({ currentTarget }: Event): string {
return (color = (currentTarget! as HTMLInputElement).value);
2021-05-30 21:44:05 +02:00
}
</script>
<div style={`--color-helper-color: ${color}`}>
<slot {colorHelperIcon} {setColor} />
2021-05-30 21:44:05 +02:00
</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>