<!-- FIXME: deal with this mess in style property. You can't do all that right in your HTML -->

<script>
    export let image = "";
    export let onclick;
    export let color = "var(--col_text_panel)";
    export let size = "25px";

    let externalClasses = "";
    export { externalClasses as class };

    const Clickablility = onclick ? "clickable" : "";

</script>

<!-- FIXME: You horrible son of a goose-->
<input class="{externalClasses} {Clickablility} icon" type="button" value="" 
style="--image: url({image}); --color: {color}; background-color: {color}; --size: {size};" 
on:click={onclick ? onclick : null}>

<style>
    :global(.icon) {
        background-color: var(--color);
        object-fit: contain;
        -webkit-mask-image: var(--image);
        mask-image: var(--image);
        mask-repeat: no-repeat;
        mask-size: contain;
        height: var(--size);
        width: var(--size);
    }

    .clickable {
        cursor: pointer;
    }
    .clickable:hover {
        background-color: var(--col_text_hint) !important;
    }
</style>