romkatv / powerlevel10k

A Zsh theme
MIT License
46.81k stars 2.21k forks source link

Setting background with "p10k segment -b" is never used #2674

Closed ddribin closed 6 months ago

ddribin commented 6 months ago

Hello,

I am trying to create a custom segment using p10k segment, and I've noticed that setting the background color with -b is never used. Trying to set it to red does not work:

  function prompt_drd_dev_env() {
    if [[ ! -z $DRD_DEV_ENV ]]; then
      p10k segment -b red -f white -t "$DRD_DEV_ENV"
    fi
  }
p10k-bg-option

But using the configuration variable POWERLEVEL9K_DRD_DEV_ENV_BACKGROUND does work:

  typeset -g POWERLEVEL9K_DRD_DEV_ENV_BACKGROUND='red'
  function prompt_drd_dev_env() {
    if [[ ! -z $DRD_DEV_ENV ]]; then
      p10k segment -f white -t "$DRD_DEV_ENV"
    fi
  }
p10k-bg-var

Using -b and the variable still does not work, as this still has a red background, as above:

  typeset -g POWERLEVEL9K_DRD_DEV_ENV_BACKGROUND='red'
  function prompt_drd_dev_env() {
    if [[ ! -z $DRD_DEV_ENV ]]; then
      p10k segment -b blue -f white -t "$DRD_DEV_ENV"
    fi
  }

I found Issue #2632, which sounds like this is intended behavior. But I'm not seeing how the -b color is ever used. What is the point of -b if it is always overridden?

I am using the P10k from git at commit 16e5848.

romkatv commented 6 months ago

I've replied in the other issue: https://github.com/romkatv/powerlevel10k/issues/2632#issuecomment-2103862027

ddribin commented 6 months ago

Alright. Let's close this one.