<script>
import { Style, visuallyHidden } from "svelte-style";
let toggled = false;
const style = "color: red";
const colorRed = (node, enabled) => new Style(node, enabled, style).init();
</script>
<button on:click={() => (toggled = !toggled)}>
Toggle <span style="color: red" use:visuallyHidden={toggled}>Text</span>
</button>
<div use:colorRed>Red text</div>