Skip to content

Use lp_terminal_format out of the prompt #783

Answered by Rycieos
nojhan asked this question in Q&A
Discussion options

You must be logged in to vote

You could manually remove the escape codes:

user_function() {
    local lp_terminal_format string
    lp_terminal_format 0 196 1
    string="${lp_terminal_format} example ${NO_COL}"
    string="${string//"$_LP_OPEN_ESC"}"
    string="${string//"$_LP_CLOSE_ESC"}"
    printf '%s\n' "$string"
}

It uses private Liquid Prompt variables, so it could break at some point. If this is something others might want to do, we could probably come up with a way to support this.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nojhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants