neofetch icon indicating copy to clipboard operation
neofetch copied to clipboard

Add ANSI 8-bit Support

Open seujorgenochurras opened this issue 2 years ago • 2 comments

Description

I'm doing an ascii art project, and I noticed that it would be awesome to have a profile picture in Neofetch, but there's a problem: for some reason, Neofetch treats 8-bit colors as actual characters.
This means that if I have, for instance, ^[[38;231;0;255m hi mom it will trhow the neofetch system information about 12 characters to the right, instead of the 1 expected.

I know this is hard af to explain, and my poorly written text doesn't help, so I have an image to give as an example: image

As you can see the information went far away, this is because it sees the ansi color as a char. For example, in the first line, we have [38;2;111;68;85m╏[38;2;132;95;113m0[38;2;101;75;104m╏

I have no idea how hard it is to fix this issue, but it shouldn't be that hard, as I was kind of able to fix it with simple tweaks. image

Now, you can argue that if I'm using chars to make colored art, why don't I use images in the first place?
And if you say that, I just gotta tell you to stop, this way of thinking hurts my feelings and f u

seujorgenochurras avatar Sep 08 '23 17:09 seujorgenochurras

I guess this isn't needed, but if you guys need the ascii art to see the bug this one might be useful:

profile.ascii.txt

I also have a smaller version of the same ascii art smallest-profile.ascii.txt

seujorgenochurras avatar Sep 08 '23 17:09 seujorgenochurras

I've fixed it by changing a line of the print_ascii() function from line=${line//█/ } to line=$(echo -e "$line" | sed -E 's/█//g; s/\x1B\[[0-9;]*[a-zA-Z]//g')

seujorgenochurras avatar Sep 08 '23 18:09 seujorgenochurras