favicon thoughts #24
Replies: 5 comments 4 replies
-
I made a change where it uses a "static" folder created in the root directory. Typically you can point to a local file, but I believe extra cors security blocks it. But css can see it, so it loads it into the files the browser can read. But it doesn't load, unless the image is set during load, so I create a hidden image. Create the link document element, parse the url (local file) of the image and set it to the vaicon. https://github.com/Gerschel/sd-web-ui-quickcss/blob/master/javascript/favicon.js |
Beta Was this translation helpful? Give feedback.
-
I had migrated the file reads into a --logo: url('file=static/logo.png');
--favicon: url('file=static/favicon.svg'); Perhaps that's the difference |
Beta Was this translation helpful? Give feedback.
-
The favicon handler was a workaround so others don't have to edit webui.py anymore, and it allows hot swapping (changing without reload), then also saves the choosen one (overwriting previous if any or default) in static folder, so it's available on subsequent loads. "Applying" favicon does the injection for the hot swap, and file write. The css file used will need: --favicon: url('file=static/favicon.svg'); And will also need targeting the container that is the workaround. .icon-container {
background-image: var(--favicon);
} To see the change without reloading the ui, you will need to do a hard refresh of the page (ctrl+f5). The browser caches the favicon, so it needs to drop the version in cache to be able to pick up the new one. This isn't the cleanest method, I swore I had a clear page cache as part of the button. I'm not sure what happened to it. |
Beta Was this translation helpful? Give feedback.
-
So when you did an inline, did it take immediate affect? I'm wondering this, because you may have come up with the other portion of the workaround. |
Beta Was this translation helpful? Give feedback.
-
I've updated both my Preview: css: retrowavePreview: css: Assets:favicon ( logo ( If you want to include these assets in your next update/release that would be fine :) |
Beta Was this translation helpful? Give feedback.
-
Hey @Gerschel and @Nacurutu,
I've been away the past month or so and recently noticed all the progress to extension; great work! I've finally gotten around to looking at the changes to the gradio compact
.css
and more or less sorted it out the way I want, although I need to clean things up a bit before posting any revisions.One looming question I have is about the
favicon
support. I'm guessing that the "apply favicon" in the extension only takes effect if thewebui.py
is edited? I have a simple way of changing thefavicon
without having to edit any files, so it might possibly be of use.If I load up the automatic1111 webui as normal, then open the
js
console I paste the two lines of code below and the default gradio is instantly swapped out with my custom animated automatic1111.svg as afavicon
:favicon injection:
I would imagine it might be possible to implement something similar to the extension once the automatic1111 interface is loaded if the user selects a custom favicon instead of the default?
Beta Was this translation helpful? Give feedback.
All reactions