I have configured some custom themes using bat that I wanted to use with this plugin, but I couldn't load them through the provided configurations.
What I ended up doing was patching the lib.rs save_image() method with this snippet:
if let Some(path) = &opts.themes_path {
ha.add_from_folder(path)
.expect("Failed to load themes on path");
}
And I am adding the themes_path as part of the Opts struct.
This works since I can now load my custom bat themes using the theme configuration option, but it feels sub-optimal because it gets run every time a new image is created. Since the process itself is very fast, I don't mind, but I was wondering if:
- Is there a better place to include loading these themes? Maybe creating a
SiliconCache or SiliconCacheBuild function loads them once and makes them available to the user. Similar to what you would do with bat cache --build.
- Is there an easier way to accomplish this that I might miss?
Adding an image of the code, I'm referring to it because I love the images created by silicon and this plugin:

I have configured some custom
themesusingbatthat I wanted to use with this plugin, but I couldn't load them through the provided configurations.What I ended up doing was patching the
lib.rssave_image()method with this snippet:And I am adding the
themes_pathas part of theOptsstruct.This works since I can now load my custom
batthemes using thethemeconfiguration option, but it feels sub-optimal because it gets run every time a new image is created. Since the process itself is very fast, I don't mind, but I was wondering if:SiliconCacheorSiliconCacheBuildfunction loads them once and makes them available to the user. Similar to what you would do withbat cache --build.Adding an image of the code, I'm referring to it because I love the images created by
siliconand this plugin: