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

[Question] way detect if theme is light or dark #71

Closed
ckjoris opened this issue Oct 2, 2024 · 5 comments
Closed

[Question] way detect if theme is light or dark #71

ckjoris opened this issue Oct 2, 2024 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@ckjoris
Copy link

ckjoris commented Oct 2, 2024

What version of tinty are you using?
tinty 0.18.0

Hi, is there a way to detect if the current theme is dark or light, or just read the 'variant' from the theme file?

I want to script this detection, so could pass the appropriate theme argument to other cli tools.

Currently having to do a bit of a workaround in the shell handler:

# tinty config
[[items]]
name = "base16-shell"
path = "https://github.com/tinted-theming/base16-shell"
hook = "cat %f > ~/.base16_theme && using_tinty=true ~/dotfiles/base16_handler_shell.sh ; . %f"
# ~/dotfiles/base16_handler_shell.sh
# get the yaml file
yaml_path=$(tinty info "$(tinty current)" | grep -Poi '\@\K.*(.*.yaml)')
# strip the leading and trailing whitespaces
yaml_path=$(echo "$yaml_path" | xargs)

$(grep "variant" "$yaml_path" | grep --silent -i "light")
is_light=$?
echo "$is_light" >> ~/.base16_theme_light
@ckjoris ckjoris added the question Further information is requested label Oct 2, 2024
@JamyGolden
Copy link
Member

JamyGolden commented Oct 2, 2024

Interesting, yes I do see the value having tinty solve your issue. I'll look at fleshing out the tinty current subcommand to accept args for the meta info of the scheme, for example tinty current variant and tinty current author. What do you think of that?

@ckjoris
Copy link
Author

ckjoris commented Oct 3, 2024

yes I do see the value having tinty solve your issue.

great!

yes, sounds like tinty current variant command would exactly solve my needs

@JamyGolden
Copy link
Member

I've created a PR for the feature: #72

I'll merge in a day or so

@JamyGolden
Copy link
Member

Just released the changes, let me know if you run into any issues 😄

@ckjoris
Copy link
Author

ckjoris commented Oct 9, 2024

works great, thanks a bunch!

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

No branches or pull requests

2 participants