rq
rq copied to clipboard
Add HJSON color output
Currently, there's no color output support for HJSON. It could hopefully share some coloring infrastructure with the JSON sink.
Cool project 👍 If it's any help to you there are new editor syntax definitions on http://hjson.org/download.html#ed and (since you are already using js) hjson-js now has a color option.
Looks like I could re-use some concepts from your link, but I'd like to match the color support of the JSON module if possible, like in this screenshot:

I think it would mostly involve changing the existing HJSON Rust library (https://github.com/hjson/hjson-rust), most likely.
The colors aren't hardcoded though I haven't added an API yet.
Adding colors to hjson-rust should not be a problem either. They could be implemented in a new formatter (see HjsonFormatter)
@laktak oh I didn't realize you're the author of that library... Makes sense!
I changed the formatter in serde_json version 0.9.0 (not yet released), see here: https://github.com/serde-rs/json/blob/v0.9.0/json/src/ser.rs#L803
I think the hjson-rust formatter would need to have a similar interface for me to be able to implement color support.