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

[Feature Request] ANSI colours support for tinty #27

Open
screwyprof opened this issue Nov 17, 2024 · 3 comments
Open

[Feature Request] ANSI colours support for tinty #27

screwyprof opened this issue Nov 17, 2024 · 3 comments
Assignees

Comments

@screwyprof
Copy link

ANSI colours support for tinty

When using tinty with ANSI colours, it expects theme-specific files in the directory specified by themes-dir. However, for ANSI colours we only have a single ansi.sh file that works for all themes.

Current behavior

When trying to use ANSI colours with tinty:

[[items]]
name = "fzf"
path = "/path/to/tinted-fzf"
themes-dir = "ansi"
hook = "cp -f %f ~/.config/fzf/colors.sh && source ~/.config/fzf/colors.sh"

It fails with:

❯ tinty apply base16-catppuccin-frappe
Theme does not exists for fzf in /Users/happygopher/.local/share/tinted-theming/tinty/repos/fzf/ansi. Try running `tinty update` or submit an issue on https://github.com/tinted-theming/tinty

Desired behaviour

Since ANSI colours are theme-agnostic (they use terminal colours), it would be helpful to:

  1. Either support a special case in tinty for ANSI colors
  2. Or provide theme-specific symlinks to ansi.sh in the repo

Current workaround

With modified config:

[[items]]
name = "fzf"
path = "${config.xdg.dataHome}/tinted-theming/tinty/repos/fzf"
themes-dir = "ansi-sh"
hook = "cp -f %f ~/.config/fzf/colors.sh && source ~/.config/fzf/colors.sh"

I create symlinks for each theme name pointing to ansi.sh:

mkdir -p ansi-sh/
cd ansi-sh/

for theme in ../sh/base16-.sh ../sh/base24-.sh; do
  name=$(basename "$theme")
  ln -s ../ansi/ansi.sh "$name"
done

This works but feels like it could be handled more elegantly at the tinty or repo level.

@JamyGolden
Copy link
Member

What I do for fzf specifically is to source the ansi.sh script file in my shell *rc file. This doesn't need to be sourced again and will simply update correctly when you switch your terminal theme:

fzf_ansi_script="/path/to/tinted-fzf/ansi/ansi.sh";
if [ -f "$fzf_ansi_script" ]; then
  . "$fzf_ansi_script"
fi

Using tinty with fzf is useful when one intends to source the tinted-fzf/sh/*.sh (or fish, etc) files.

@screwyprof
Copy link
Author

screwyprof commented Nov 18, 2024

Hey @JamyGolden, yes, I understand that. Just I thought the whole idea of having a theme manager is to, well manage themes via a manager for all the apps :) But in reality, at this moment it's not a trivial task, lots of applications require custom setups...

Update: I guess the problem is tinty is not flexible enough at this stage to handle this case. Maybe its hooks could be extended in future to support actions on the repo level and not only a specific theme file. Than in this case, the hook will just source ansi/ansi.sh

@JamyGolden
Copy link
Member

JamyGolden commented Nov 18, 2024

Ah ok yes I see what you mean. Currently it is possible with tinty but a little hacky. You could add fzf to tinty, set the themes dir to “sh” (will be unused) and then use the global tinty “hooks” property to source ansi.sh.

hooks = [“~/.local/share/tinted-theming/tinty/repos/fzf/ansi/ansi.sh”]

[[items]]
name = "fzf"
path = "https://github.com/tinted-theming/tinted-fzf"
themes-dir = "sh"

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

No branches or pull requests

2 participants