Closed mkanet closed 1 year ago
@mkanet your background template has a leading and trailing space in the resulting color string which evaluates as invalid. As we do not trim (and not plan to), removing the spaces will result in a working setup:
"background_templates": [
"{{ if eq .Env.ElevatedPINNotAuthorized \"True\" }}#ff0000{{ end }}"
],
@JanDeDobbeleer thank you so much for telling me what I did wrong. I'm embarrassed to say how much time I spent looking for the solution to this!
I really appreciate your hard work keeping Oh My Posh updated. It's my new favorite MS Terminal toy.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
Version: 14.9.2 (amd64) Windows 10 22H2 PowerShell 5.1
I made a simple custom theme based on existing Oh My Posh themes and documentation (see theme code section below). However, no matter what I do, I can't force the
background_templates
condition to use the specified color when the condition is met. In fact, any color I specify in the condition seems to be treated as a null value.NOTE: The condition is detected correctly when the respective environment variable's value is detected... However, it is not changing the color of the first couple of segments to #ff0000 aka RED. It looks like it sets the color to NULL. There are no syntax errors. I'm not sure what I'm missing.
Expected behavior:
Actual Behavior:
Could you please tell me what I'm doing wrong? I've spent a great deal of time trying to get this to work before asking for help.
Thank you in advance for your assistance.
Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
powershell
Log output