Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Unique ID Assignment to Enable Checkbox #22

Open
da2el-ai opened this issue Jan 24, 2024 · 2 comments
Open

Request for Unique ID Assignment to Enable Checkbox #22

da2el-ai opened this issue Jan 24, 2024 · 2 comments

Comments

@da2el-ai
Copy link

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
Copy link
Owner

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
Copy link
Contributor

w-e-w commented Feb 9, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants