1 unstable release
0.1.0 | Dec 25, 2024 |
---|
#1540 in Command line utilities
146 downloads per month
5KB
hoicolor
a simple rust lib to convert from hearts of iron 4 (hoi4) escaped color sequences to ansi for stdout.
the original purpose in creating this project was for my other hoi4 related project hoiscan. this along with hoiscan is my first experience using rust. originally i was going to use python or javascript, but bindings to the steamworks library for those languages were limited. my other options were c/cpp/rust. i chose rust because of my positive experience building/using rust from other open source projects.
hoi4 uses escape sequences similar to minecraft¹. a start of a color is indicated by the unicode character U+0011 ()
followed by and english character representing the color (e.g. White: W). to end a sequence the unicode character followed by !
is used². stdout however cannot understand this. so, hoicolor maps a hoi4 colored string and replaces the colors with ansi color sequences³.
usage
use hoicolor::Converter;
fn from_hoi(s: String) -> String {
let converter: Converter = Converter(s);
return s.to_ansi(); // hoi4 -> ansi
}
thanks
- @ewof for the hoi4 colors paste
todo
- api to convert from ansi/human readable color -> hoi4 color