Haruno19/starfetch

[Feature Request] Color customization?

TheLastTeapot opened this issue · 13 comments

Is it possible to add color customization for all the elements? It looks really ugly with my terminal colors, but I need them the way they are for other things. Also, what font is used for the name above the art? It doesn't show up properly for me

Yes, it's a nice idea to add color customization! Thank you!
I won't be able to work on it anytime soon, sadly (I have other projects and deadlines with university 😢) but I like the idea and I'll keep this issue open with the feature request label!

About the text used to display the constellations' names, they are written in the JSON files using full width unicode characters, you'll need a font that support those characters for them to be displayed correctly in your terminal (e.g. Menlo, Cascadia Code...)

Alright, Thank you!

Thanks to @su8 with PR #33 stars are now colored!

I'll still keep this issue open because I'd like to improve this feature further, implementing a parameter so that the user can manually select a color when launching starfetch, and maybe not only for the stars but for other things too (e.g. the text which now is printed as bold text maybe) :)

su8 commented

It's not that hard to implement it - https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2124

Just declare several global variables either std::string or define them and add another cli flag such as -c and test the input argv[2] for the requested color if it matches the if / else if. I tried to colorize the rest parameters but the side pipes and underlying pipes are not colorized.

su8 commented

The lines that I added colorization are the following:

Added colorization befor the j and after them \033[0;0m

s.replace(s.find("%0"), string("%0").size(), j["title"].get<string>());
s.replace(s.find("%11"), string("%11").size(), j["name"].get<string>());
s.replace(s.find("%12"), string("%12").size(), j["quadrant"].get<string>());
s.replace(s.find("%13"), string("%13").size(), j["right ascension"].get<string>());
s.replace(s.find("%14"), string("%14").size(), j["declination"].get<string>());
s.replace(s.find("%15"), string("%15").size(), j["area"].get<string>());
s.replace(s.find("%16"), string("%16").size(), j["main stars"].get<string>());

su8 commented

Waited 1 hour and implemented the feature by myself.

su8 commented

starfetch -c yellow -n orion

Screenshot

@su8 you're amazing :)
Thank you a lot!!

Thanks so much @su8! I don't know if you're aware, but it does only work when you specify a specific constellation.

su8 commented

The color by default is cyan if you don't specify one with the -c option. If you run the program without specifying color and/or constellation it uses cyan color and some random constellation.

but if I run starfetch -c yellow, it gives :Available colors are: black, white, cyan, magenta, yellow, red, blue. It only works if I do :starfetch -c yellow -n sagittarius, then it is yellow.

su8 commented

Nice cath, it's fixed in #35

Thanks!