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

Load bat custom themes #36

Open
guzmonne opened this issue Mar 26, 2023 · 0 comments
Open

Load bat custom themes #36

guzmonne opened this issue Mar 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@guzmonne
Copy link

guzmonne commented Mar 26, 2023

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:

  1. 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.
  2. 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:

silicon_20230326_023847

@krivahtoo krivahtoo added the enhancement New feature or request label Mar 26, 2023
krivahtoo added a commit that referenced this issue Apr 1, 2024
- Added `list_themes()` function to retrieve available themes.
- Added `config_path()` function to retrieve the project's config path.
- Added `rebuild_themes()` function to rebuild themes with an optional path parameter.

Fixes: #47
Related: #36 #41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants