From 7b19474cb2dd8f2c34d630f43edb0fcb0e05aa0c Mon Sep 17 00:00:00 2001 From: pngwn Date: Tue, 16 Jul 2024 19:43:29 +0100 Subject: [PATCH] Ensure `ImageEditor` brush color can be updated with `gr.update` (#8802) * fix brush * add changeset * fix brush --------- Co-authored-by: gradio-pr-bot --- .changeset/silver-emus-attend.md | 6 ++++++ js/imageeditor/shared/tools/Brush.svelte | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/silver-emus-attend.md diff --git a/.changeset/silver-emus-attend.md b/.changeset/silver-emus-attend.md new file mode 100644 index 0000000000000..445fb9d6a4eed --- /dev/null +++ b/.changeset/silver-emus-attend.md @@ -0,0 +1,6 @@ +--- +"@gradio/imageeditor": patch +"gradio": patch +--- + +fix:Ensure `ImageEditor` brush color can be updated with `gr.update` diff --git a/js/imageeditor/shared/tools/Brush.svelte b/js/imageeditor/shared/tools/Brush.svelte index 84fb39745acc0..5a9d165da8acd 100644 --- a/js/imageeditor/shared/tools/Brush.svelte +++ b/js/imageeditor/shared/tools/Brush.svelte @@ -43,11 +43,11 @@ export let color_mode: Brush["color_mode"] | undefined = undefined; export let mode: "erase" | "draw"; - const processed_colors = colors + $: processed_colors = colors ? colors.map(process_color).filter((_, i) => i < 4) : []; - let selected_color = + $: selected_color = default_color === "auto" ? processed_colors[0] : !default_color