Fix color defaulting to black

Closes #2261
This commit is contained in:
Damien Elmes 2022-12-11 11:58:21 +10:00
parent f9f8769ea8
commit 8d34ba93b0
3 changed files with 4 additions and 1 deletions

View file

@ -6,11 +6,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import Shortcut from "../../components/Shortcut.svelte"; import Shortcut from "../../components/Shortcut.svelte";
export let keyCombination: string | null = null; export let keyCombination: string | null = null;
export let value: string;
let inputRef: HTMLInputElement; let inputRef: HTMLInputElement;
</script> </script>
<input bind:this={inputRef} tabindex="-1" type="color" on:input on:change /> <input bind:this={inputRef} tabindex="-1" type="color" bind:value on:input on:change />
{#if keyCombination} {#if keyCombination}
<Shortcut {keyCombination} on:action={() => inputRef.click()} /> <Shortcut {keyCombination} on:action={() => inputRef.click()} />

View file

@ -127,6 +127,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
> >
{@html chevronDown} {@html chevronDown}
<ColorPicker <ColorPicker
value={color}
on:input={(event) => { on:input={(event) => {
color = setColor(event); color = setColor(event);
bridgeCommand(`lastHighlightColor:${color}`); bridgeCommand(`lastHighlightColor:${color}`);

View file

@ -146,6 +146,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{@html chevronDown} {@html chevronDown}
<ColorPicker <ColorPicker
keyCombination={pickCombination} keyCombination={pickCombination}
value={color}
on:input={(event) => { on:input={(event) => {
color = setColor(event); color = setColor(event);
bridgeCommand(`lastTextColor:${color}`); bridgeCommand(`lastTextColor:${color}`);