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

It would be great to be able to paint gradients in TMUX and Powerline directly with pastel #174

Open
purplefishies opened this issue Nov 21, 2022 · 1 comment

Comments

@purplefishies
Copy link

Hi ,

It would be really nice to be able to paint gradients directly with pastel. You have the ability to read from stdin a set of colors such as those generated by pastel. It would really be nice to be able to take that input stream and "paint" a text string using a modified version of the output.

For instance, tmux requires that the colors have the prefix "#[fg=" and suffix "]".

I created a modified bash script that generates the required formats to create a gradient in tmux but it would be much nicer to be able to do it directly with speedy pastel.

#!/bin/bash

color_from="$1"
color_to="$2"
text="$3"

length=${#text}

colors=$(pastel gradient -n "$length" "$color_from" "$color_to" -sLCh)

i=0
for color in $colors; do
    echo -ne "#[fg=$(pastel format hex "$color")]${text:$i:1}"
    i=$((i+1))
done
printf "\n"

Is there any guidance you can give for how you could see the syntax being ? I'm happy to work on a PR to make this work

@sharkdp
Copy link
Owner

sharkdp commented Jan 14, 2023

Thank you for your request. Being able to write Bash scripts like yours above is exactly what pastel was designed for. To be honest, I'm not convinced that this needs to be a builtin feature. Maybe with ANSI colors, but probably not with tmux-custom color codes.

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