jnoortheen / xontrib-powerline3

powerline theme for xonsh with async prompt support.
MIT License
11 stars 4 forks source link

Is there a way to customise the colour and background colours of custom fields #9

Closed Cadair closed 2 years ago

Cadair commented 2 years ago

Is there a way I am missing or could there be a way to allow customisation of custom fields (either as strings or a python function) which let's you set the colour of parts of a field, i.e. not separated by a powerline separator?

It seems that the built-in {BACKGROUND_BLACK} style formatters aren't supported?

Thanks a lot for a nice library!

jnoortheen commented 2 years ago

you can use the below setting for custom fields as well

# these are the default colors and they are configurable.
$PROMPT_FIELD_COLORS = {
    "cwd": ("WHITE", "CYAN"),
    "gitstatus": ("WHITE", "BLACK"),
    "ret_code": ("WHITE", "RED"),
    "full_env_name": ("white", "green"),
    "hostname": ("white", BLUE),
    "localtime": ("#DAF7A6", "black"),
}
jnoortheen commented 2 years ago

Now it is changed to use the prompt fields itself

# the foreground/background colors of the prompt-fields can be configured as below. 
# This works for custom fields as well
# The format is `<prompt-field-name>__pl_colors`. It can be a function returning `tuple[str, str]`
# or set tuples directly as below.
$PROMPT_FIELDS["cwd__pl_colors"] = ("WHITE", "CYAN")
Cadair commented 2 years ago

Thanks for the responses :)

I think you missed what I was asking for, I would like to change the font colour half way though a field, I have a custom field which returns this:

cadair@laptop

I would like the cadair and @laptop parts to have different colours.

Thanks again!

jnoortheen commented 2 years ago

Ok that is not an intended scenario. It considers that each field has the same color and background colour.

Cadair commented 2 years ago

Fair enough, thanks again.