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

How do you get the equivalent of tmux default color #296

Closed
purplefishies opened this issue Oct 28, 2022 · 3 comments
Closed

How do you get the equivalent of tmux default color #296

purplefishies opened this issue Oct 28, 2022 · 3 comments

Comments

@purplefishies
Copy link

Hi,

While configuring this, I find that I can't actually get a color that matches tmux's "default" color...which in the case of a translucent window, allows me to get transparency .

Curious what value we can set a segment to do get this effect.

@erikw
Copy link
Owner

erikw commented Oct 28, 2022

@purplefishies run the color_palette.sh to see what colors you have to chose from :)

@purplefishies
Copy link
Author

Hi Erik,

No, it's not a color issue. It's the fact that you can't specify "default" as a color...something you can do in tmux and it allows you honor the back color erase "bce".

I have a fix that allows this "default" color to be specified.

__print_colored_content() {
    bgcolor="$2"
    fgcolor="$3"
    if [[ $bgcolor == "default" ]] ; then
        BGCOLOR=$bgcolor
    else
	[ "${bgcolor:0:1}" = "#" ] && BGCOLOR="$bgcolor" || BGCOLOR="colour$bgcolor"
    fi

    if [[ "$fgcolor" == "default" ]] ; then
        FGCOLOR=$fgcolor
    else
	[ "${fgcolor:0:1}" = "#" ] && FGCOLOR="$fgcolor" || FGCOLOR="colour$fgcolor"
    fi

    echo -n "#[fg=${FGCOLOR},bg=${BGCOLOR}]"
    echo -n "$1"
    echo -n "#[default]"
}

Let me know if I should submit a PR ?

@erikw
Copy link
Owner

erikw commented Oct 30, 2022

Ah now I see what you mean @purplefishies. This make sense, please make a PR! :)

Please add a comment after this line in the PR to mention that also the value default can be used:

# Format: segment_name background_color foreground_color [non_default_separator]

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

No branches or pull requests

2 participants