Inzaniak / sd-webui-ranbooru

71 stars 7 forks source link

Request for Unique ID Assignment to Enable Checkbox #22

Open da2el-ai opened 10 months ago

da2el-ai commented 10 months ago

I would like to request the assignment of a unique ID to the "Enable" checkbox.

I am currently developing an extension to customize the UI of the webui. https://github.com/da2el-ai/sd-d2-ui-customizer

The extension includes a feature that changes the extension panel background color when activated.

However, I am unable to customize the color for the "Enable" activation checkbox as it does not have a unique ID.

I would appreciate it if you could address this issue.

Thank you.

Inzaniak commented 10 months ago

Hey! I'm not really sure what do you mean with "unique ID" (Gradio is not something I'm used working with). If you can explain what I need to change, I'll be happy to implement it in the main branch.

w-e-w commented 9 months ago

@Inzaniak

unless I'm very much mistaken @da2el-ai asking for you to assing a custom element id

(as opposed to having gradio auto assign a value) this isn't really Gradio but more about web frontend in general

example https://github.com/w-e-w/sd-webui-hires-fix-tweaks/blob/2de87765aaae50dbeb077acf5d7d97eb93a20253/hires_fix_tweaks/ui.py#L156C142-L156C191 using self.script.elem_id("seed_resize_from_w") will create a unique element ID for this element

and if you look ate the webpage you will see image

you can assine any strng as the ID as long as it is unique, self.script.elem_id is a helper function in webui that auto creates a prefix that should be unique

the ID has many useses, and as the name suggests it mostly helps you to identify the element one of the most common use of the ID is to be used as a means of selecting an element in JavaScript the other uses of the ID inside web UI such as https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/d69a7944c9ad5a086d99cf9220a3a2742a1194f3/modules/scripts.py#L942-L969


@da2el-ai after you finished developing your extension if you wish to share your extension to the public you can make a PR to webui's extension index to have it listed https://github.com/AUTOMATIC1111/stable-diffusion-webui-extensions