Skip to content

Commit 1d1a4a3

Browse files
authored
feat: add inpaint color picker (#2997)
Workaround as tool color-sketch applies changes directly to the image canvas and not the mask canvas. Color picker is not correctly implemented in Gradio 3.41.2 => does always get displayed as separate containers and not merged with other elements
1 parent d850bca commit 1d1a4a3

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

css/style.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ progress::after {
7272

7373
.progress-bar span {
7474
text-align: right;
75-
width: 200px;
75+
width: 215px;
7676
}
7777

7878
.type_row{
@@ -399,4 +399,8 @@ progress::after {
399399
text-align: center;
400400
border-radius: 5px 5px 0px 0px;
401401
display: none; /* remove this to enable tooltip in preview image */
402+
}
403+
404+
#inpaint_brush_color input[type=color]{
405+
background: none;
402406
}

webui.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,20 @@ def update_history_link():
524524
inpaint_mask_upload_checkbox = gr.Checkbox(label='Enable Mask Upload', value=False)
525525
invert_mask_checkbox = gr.Checkbox(label='Invert Mask', value=False)
526526

527+
inpaint_mask_color = gr.ColorPicker(label='Inpaint brush color', value='#FFFFFF', elem_id='inpaint_brush_color')
528+
527529
inpaint_ctrls = [debugging_inpaint_preprocessor, inpaint_disable_initial_latent, inpaint_engine,
528530
inpaint_strength, inpaint_respective_field,
529531
inpaint_mask_upload_checkbox, invert_mask_checkbox, inpaint_erode_or_dilate]
530532

531533
inpaint_mask_upload_checkbox.change(lambda x: gr.update(visible=x),
532-
inputs=inpaint_mask_upload_checkbox,
533-
outputs=inpaint_mask_image, queue=False, show_progress=False)
534+
inputs=inpaint_mask_upload_checkbox,
535+
outputs=inpaint_mask_image, queue=False,
536+
show_progress=False)
537+
538+
inpaint_mask_color.change(lambda x: gr.update(brush_color=x), inputs=inpaint_mask_color,
539+
outputs=inpaint_input_image,
540+
queue=False, show_progress=False)
534541

535542
with gr.Tab(label='FreeU'):
536543
freeu_enabled = gr.Checkbox(label='Enabled', value=False)

0 commit comments

Comments
 (0)