Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Overriding colors? #197

Description

@luanalatte

I wanted to override the colors used in pfetch with truecolor escape sequences. I tried doing so while not modifying pfetch's code so I used PF_SOURCE but the palette was being set AFTER sourcing my script.

One option is to move the sourcing of the script to after the colors have been set.

Another one is to add a check and skip setting colors that are already set:

for _c in c1 c2 c3 c4 c5 c6 c7 c8; do
    [ -z "${!_c}" ] || continue
    esc SGR "3${_c#?}" 0
    export "$_c=$e"
done

However I am not sure if ${!_c} is POSIX sh. Also, it's possible there's a better way to do it.

It works with this on my PF_SOURCE script:

c4="${esc_c}[38;2;255;0;0m"

Although it also needs this change to https://github.com/dylanaraps/pfetch/blob/master/pfetch#L1827 so that it doesn't count the extra characters in the escape sequence:

$(printf %s "$ascii" | sed 's/�\[3.*m//g')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions