[X] I agree to follow this project's Code of Conduct
What happened?
Whilst I was changing my oh-my-posh config to use palette colors, I noticed some curious behaviour when setting the segment foreground color to point to a palette color with value of transparent. The background color of the segment turned grey even though it was explicitly set to a different value in the config.
final_space = true
version = 2
[palette]
text-foreground = "transparent"
[[blocks]]
type = "prompt"
alignment = "left"
[[blocks.segments]]
type = "text"
style = "plain"
foreground = "p:text-foreground" # Changing this to "transparent" works, but "p:text-foreground" doesn't.
background = "green"
template = "This text should have a green background."
Code of Conduct
What happened?
Whilst I was changing my oh-my-posh config to use palette colors, I noticed some curious behaviour when setting the segment foreground color to point to a palette color with value of
transparent
. The background color of the segment turned grey even though it was explicitly set to a different value in the config.I can reproduce this issue with the provided config on the
main
branch (https://github.com/JanDeDobbeleer/oh-my-posh/commit/bbbc8c521463583e83a5c6f5c28d39b6e7cb6028). I expected the resulting output to be some text on a green background; however the actual output is some text on a grey background.I think the bug might be related to this function: https://github.com/JanDeDobbeleer/oh-my-posh/blob/bbbc8c521463583e83a5c6f5c28d39b6e7cb6028/src/terminal/writer.go#L595-L613 When the foreground color is set to
p:text-foreground
,inverted
is false becauseforeground
doesn't get resolved from a palette reference to the final actual value. I'm unsure why exactly does this cause problems, but after some experimenting I wrote a hacky workaround for myself (https://github.com/Nettifani/oh-my-posh/commit/c77246a7d812740f2e123fab3fb4421b80f7bbd7) which seems to resolve the issue. I hope the information I have provided is useful in some way :)Theme
What OS are you seeing the problem on?
Linux
Which shell are you using?
bash
Log output