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

SPACESHIP_SECTION_COLOR not working in prompt 4.x #1344

Closed
SirDoctorK opened this issue Mar 29, 2023 · 1 comment
Closed

SPACESHIP_SECTION_COLOR not working in prompt 4.x #1344

SirDoctorK opened this issue Mar 29, 2023 · 1 comment
Labels
bug Bug related to code base, behavior, displaying, etc.

Comments

@SirDoctorK
Copy link

The problem

I recently set up a new computer with my standard dotfiles for the first time in a while and found that my custom section at the start of the prompt is no longer colored properly. Instead of setting the desired orange color, it just prints '166' before the lambda character.

Screen Shot 2023-03-08 at 14 56 44

Because the new computer was a Mac, I assumed it was due to some weirdness on that OS and opened a Q&A on the matter. I'll aim to put all relevant information here but here's the Q&A in case it's helpful: #1339

I found that on my Ubuntu 20.04 in WSL environment, pulling the latest version of the prompt caused the same issue to show up on the Windows Terminal. However, when I switched to the v3.16.7 tag the color came back, and going back to 4.0.0 returned it to the grey 166. So something in the 4.0.0 major release broke the color declaration I've been using.

I tried a few different ways of indicating the color and reordering my section so it's not the first item to no avail. I also tried changing dir.zsh to use my 166 color code and it went to the orange color with no problems, so I'm inclined to think that this is a bug and not a deliberate change in interpretation that hadn't been updated in the documentation.

Full zsh configs here: https://gitlab.com/SirDoctorK/dotfiles

Relevant Zsh configuration

=== zshrc (excerpt) ====
SPACESHIP_PROMPT_ORDER=(
    lambda        # Custom orange lambda character
    user          # Username section
    host          # Hostname section
    dir           # Current directory section
    git           # Git section (git_branch + git_status)
#    hg            # Mercurial section (hg_branch  + hg_status)
#    package       # Package version
#    node          # Node.js section
#    ruby          # Ruby section
#    elixir        # Elixir section
#    xcode         # Xcode section
#    swift         # Swift section
#    golang        # Go section
#    php           # PHP section
#    rust          # Rust section
#    haskell       # Haskell Stack section
#    julia         # Julia section
#    docker        # Docker section
#    aws           # Amazon Web Services section
#    venv          # virtualenv section
#    conda         # conda virtualenv section
#    pyenv         # Pyenv section
#    dotnet        # .NET section
#    ember         # Ember.js section
#    kubecontext   # Kubectl context section
    exec_time     # Execution time
    jobs          # Background jobs indicator
    line_sep      # Line break
#    vi_mode       # Vi-mode indicator
    char          # Prompt character
)

SPACESHIP_RPROMPT_ORDER=(
    exit_code     # Exit code section
#    battery       # Battery level and status
    time          # Time stampts section
)

SPACESHIP_TIME_SHOW=true
SPACESHIP_TIME_COLOR=blue
SPACESHIP_USER_SHOW=needed
SPACESHIP_USER_PREFIX="as "
SPACESHIP_HOST_PREFIX="on "
SPACESHIP_HOST_SHOW=true
SPACESHIP_DIR_TRUNC=0
SPACESHIP_DIR_TRUNC_REPO=false
SPACESHIP_GIT_BRANCH_COLOR=green
SPACESHIP_EXIT_CODE_SHOW=true
SPACESHIP_EXIT_CODE_SYMBOL='x'
SPACESHIP_CHAR_PREFIX=''
SPACESHIP_CHAR_SYMBOL="> "
SPACESHIP_BATTERY_SHOW=always

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="spaceship"

=== lambda.zsh ===
#
# Lambda
#
# Just a little nod to Half-Life that can be placed anywhere in the prompt
#

# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------

SPACESHIP_LAMBDA_SHOW="${SPACESHIP_LAMBDA_SHOW=true}"
SPACESHIP_LAMBDA_PREFIX="${SPACESHIP_LAMBDA_PREFIX=""}"
SPACESHIP_LAMBDA_SYMBOL="λ "
SPACESHIP_LAMBDA_SUFFIX="${SPACESHIP_LAMBDA_SUFFIX=""}"
#SPACESHIP_LAMBDA_COLOR="${SPACESHIP_LAMBDA_COLOR="d75f00"}"
SPACESHIP_LAMBDA_COLOR="166"

# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------

spaceship_lambda() {
  [[ $SPACESHIP_LAMBDA_SHOW == false ]] && return

#  spaceship::section "$SPACESHIP_LAMBDA_COLOR" "$SPACESHIP_LAMBDA_SYMBOL"

  spaceship::section \
    "$SPACESHIP_LAMBDA_COLOR" \
    "$SPACESHIP_LAMBDA_PREFIX" \
    "$SPACESHIP_LAMBDA_SYMBOL" \
    "$SPACESHIP_LAMBDA_SUFFIX"
}

What is version of Spaceship are you using?

4.13.3

What is version of Zsh are you using?

zsh 5.8 (x86_64-ubuntu-linux-gnu)

What operation system are you running?

MacOS 12.6.3, Ubuntu 20.04 (through WSL)

Do you use any Zsh framework or plugin manager?

oh-my-zsh

Which terminal emulator do you use?

Mac Terminal, Windows Terminal

Additional information

No response

@SirDoctorK SirDoctorK added the bug Bug related to code base, behavior, displaying, etc. label Mar 29, 2023
@SirDoctorK
Copy link
Author

In working on another section, I discovered the problem with this one. The section syntax has updated for v4 and I didn't realize it. Refer to the example section for the new syntax to use: https://github.com/spaceship-prompt/spaceship-section/blob/main/spaceship-section.plugin.zsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug related to code base, behavior, displaying, etc.
Development

No branches or pull requests

1 participant