plumatic / schema

Clojure(Script) library for declarative data description and validation
Other
2.4k stars 256 forks source link

Ability to disable ANSI coloring #423

Open vemv opened 4 years ago

vemv commented 4 years ago

ANSI coloring appears to be unconditional:

https://github.com/plumatic/schema/blob/ddb54c87dea6926c6d73542e517b53685cc82a37/src/clj/schema/macros.clj#L250

...which causes ugly output in my CIDER test buffers:

image

...probably this can be problematic as well in various terminal clients.

I'd suggest introducing a JVM property for deciding whether the user wishes coloring.

WDYT?

Thanks - V

w01fe commented 4 years ago

Yeah, that is unfortunate. If the coloring is problematic, I'd maybe prefer to just remove the coloring entirely. PR welcome!

vemv commented 4 years ago

Hi @w01fe !

For the time being I don't have the ability to contribute, due to IP concerns.

I'd appreciate the removal which seems simple enough!

Thanks - V

philomates commented 4 years ago

for context, this behavior was introduced in https://github.com/plumatic/schema/pull/383

I find it very useful in situations where it correctly renders the colors, so I would vote for some sort of configuration to toggle it

vemv commented 4 years ago

Yes, I'd be perfectly ok with a JVM property and default to the current behavior

w01fe commented 4 years ago

My potential concerns with the JVM property are that (1) there are many potential ways one might want to configure the printing, and (2) I'm not sure how well that will work in CLJS. A printer that's configurable the same way other options are currently (i.e. a var you can rebind with any print function you like) seems like it might be a better solution to me.

In any case, I agree it should be an easy change, but I'm sorry to say I'm personally not actively developing this library at the moment. Another contributor might decide to pick it up, though.