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

Custom Preview Themes #318

Open
Mootikins opened this issue Dec 18, 2020 · 8 comments
Open

Custom Preview Themes #318

Mootikins opened this issue Dec 18, 2020 · 8 comments

Comments

@Mootikins
Copy link

Did a discussion occur before?
Cannot log into chat, but did not see from my searches in the issue tracker.

Is your feature request related to a problem? Please describe.
Support custom syntax themes for the preview pane (specifically the text and binary views).

Describe the solution you'd like
Something similar to bat's implementation would probably be best -- a directory in the config directory named themes that stores all custom themes.

Alternatively (or in addition), allow using the shell's 16 colors as the highlighting colors.

Describe alternatives you've considered
I'm content to deal with it, though I'd like to be able to define my own themes as I use theme templates built by wpgtk. Using a Sublime Text theme is fine, as I already have one templated for bat, and using shell colors would be even better as it would be one less symlink to setup on new systems.

Additional context
I just like mah purty colors shrug

@Canop
Copy link
Owner

Canop commented Dec 18, 2020

This may not be a satisfactory answer but right now it's possible to choose among syntect standard themes: https://dystroy.org/broot/conf_file/#syntax-theme

If I support personal themes, they will have to be compatible with syntect.

Note that the binary view is customized with the skin colors.

@Mootikins
Copy link
Author

bat also uses syntect for its highlighting, so I suspect it should be compatible, though there would probably be a fair bit of work as bat actually caches the themes into a .bin file.

I'll do some looking at the bat source code as I'd be willing to implement it myself.

@AndydeCleyre
Copy link

Noting here that #297 offers an alternative path to this result, wherein the user could even use bat as broot's previewer for matching filetypes.

@Mootikins
Copy link
Author

I actually agree, the easiest workaround would be to allow an external preview program similar to the way FZF and ranger allow external programs' stdout to be used as the preview. This could also allow for us to possibly use ueberzug or w3mimgdisplay as possible image backends.

@chtenb
Copy link

chtenb commented Aug 21, 2023

Is there currently any way to achieve this? I would really like to use my own syntect colorscheme, which I also use for bat and other applications.

@ismay
Copy link
Contributor

ismay commented Apr 14, 2024

This also came up in #867. Broot now has an 8 bit color scheme, but since syntax highlighting is handled separately, by syntect, that area of broot's UI will need to be set to an 8 bit color scheme as well.

As mentioned, bat also uses syntect, and has several 8 bit themes: https://github.com/sharkdp/bat?tab=readme-ov-file#8-bit-themes. See here for example: https://github.com/sharkdp/bat/blob/master/assets/themes/ansi.tmTheme. These are compatible with syntect.

Allowing a user to either use themes other than the ones shipped by syntect, or specifying an alternate preview command would both satisfy my usecase. I.e., display all of broot's UI in the terminal's native color scheme.

@ismay
Copy link
Contributor

ismay commented Apr 14, 2024

Maybe an incremental solution would be appropriate as well:

  • First allowing for custom themes for syntect, as specified by the user. Assuming that that's the simplest to implement.
  • Second, allowing for the entire preview command to be specified by the user (if still necessary). Assuming that this is more involved (Feature request: Configurable preview_binary #587)
@chtenb
Copy link

chtenb commented Apr 14, 2024

As mentioned, bat also uses syntect, and has several 8 bit themes: sharkdp/bat#8-bit-themes. See here for example: sharkdp/bat@master/assets/themes/ansi.tmTheme. These are compatible with syntect.

Just putting this out here, this is a more advanced 8-bit color scheme for syntect:
https://github.com/chtenb/neo-ansi/blob/main/terminal-neo-ansi.tmTheme

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