I’ve been an absolutely enthusiastic Silverbullet user for about a week now. I am currently busy trying to exploit the “hackable” aspect of silverbullet and am customizing a few things. Unfortunately, I am currently desperate about 2 things:
How do I change the favicon?
How do I get silverbullet to start in the dark theme in a browser with a dark theme? I can make the setting manually, but after the cookies get deleted automatically Silverbullet starts in light mode again. Or is this behavior normal? Then I would realize the switching via js.
Can you please give me a tip on how to do this?
If relevant: I have installed Silverbullet via Docker Compose and integrated Caddy as a reverse proxy in the stack to use SSL
Bumping this up; I was also looking for a way to change favicon.
I just started using SilverBullet, so still figuring my way around. But perhaps we can use media transclusion tagged to point it to replace the default favicon?
Replying on 2.
After having a look at the source, it seems like at the moment, silverbullet only looks at the darkMode key in the clientStore and sets the theme accordingly in the “editor:init” event. This leads to the behaviour you described, meaning it ignores browser theme (-changes).
My current solution is this space-script, registering a listener to “editor:init”, that itself adds a listener to the '(prefers-color-scheme: dark)' media query change event, updating the editor ui everytime this event is called:
This didn’t work for me, and also, I am not sure how this technically could work.
My initial assumption is that the new favicon png (or ico) files needs to go somewhere in the docker container file structure, but i couldn’t find where
I tried @22rw option but i could not make it work.
I tried for example the following:
location /.client/favicon.png {
# eg: /var/www/media/silverbullet/favicon.png
alias /space/favicon.png;
}
so pointing to a file I have inside my space but it didn’t work.
@norlan space-script works… mostly
It does change the favicon for the site, but not for the PWA.
I am indeed interested on the PWA too as I want to distinguish the personal and professional instance when opening them in my phone.
Hey @paletochen
Did you put the location block with the favicon before the ‘/’-block with the reverse-proxy directive inside?
Otherwise the first block acts as a catch-all and returns before the favicon-block is reached.
But even if it worked, I’m pretty certain that this doesn’t solve the favicon issue in the PWA :\
Actually, no, i put it after the / block so, you may be right that this could be the reason it didn’t work.
I may try it again, it could avoid me one extra space-config in the instance to change the favicon.
But yes, the one I care the most is the PWA one.
Thanks for coming back to this
UPDATE: It works adding it before the / section but, as you imagined, the PWA icon is not resolved yet
Did some more digging, and actually managed to change the PWA icon!
Looking in the web manifest, there’s another, larger png file at /.client/logo-dock.png.
If you serve your own file instead, the startup-/splashscreen-icon and app-icon of the PWA are changed to the new image (might require a reinstall):
location /.client/logo-dock.png {
alias /var/www/media/silverbullet/logo-dock.png;
}
The result (my custom image is just the inverted default image):
If by substitute you mean having your reverse-proxy serve your own image file whenever the /.client/logo-dock.png file is requested - yes ;D
I don’t think it’s currently (easily) possible to substitute the actual image file inside the container, mainly because there is no separate image file.
In the docker container, the image is just a base64 string somewhere in the silverbullet.js file. You could theoretically edit this file and replace the string with your own base64 encoded image, but this would reset whenever a new image is pulled, so I don’t think the effort is worth it.