Comments (2)
Hi!
Figured I'd leave my thoughts on the matter, as I also have some very similar errors for a tool I've been working on, and am a screenreader/braille display user myself. FWIW a fully 'colored' error of my tool looks incredibly similar to miette as it was inspired by orogene:
So hopefully this isn't too far off from miette. Most terminals don't really have a good story here, so the best bet is generally to offer options:
-
For color there is a standard
CLICOLOR=
variable that can be set to1
, or0
. It can be really wanting to setup some sort of 'color-blind' friendly colors, but this is pretty diminishing return as there are still lots of terminals like it or not that only have 16 color choices. I've found creating color-blind friendly variants in being unstandard, and small returns to not really be worth it (how many people are going to know a tool was built with miette, and to use:MIETTE_A11Y_MODE="red_green_unclear"
to know to distinguish reds/greens a bit more, and is using a terminal where it'll actually do something because you have a wide range of colors?). -
The best thing besides a color variant for screenreader users, I've found is to offer separate output modes that can be configured similar to how a user would expect with log formatting. I recommend having:
- A 'fancy' output format with/without colors where you show the nice multiline that is easier for people to read.
- A 'condensed' output format where more things are based on lines of information (this makes it simple for people like me who will be using a braille reader on a terminal -- e.g. OSX voiceover on terminal is pretty atrocious so it's just easier to use my braille reader there).
- A machine parseable (json is probably easiest because
jq
is a very easy tool to get) format that is well split up so a custom set of information can be extracted easily. Knowing I can just pipe all output to a file, and then use jq to get just what I care about later is honestly the easiest way to make sure I'm never blocked.
from miette.
Thanks for your comment! This is super useful. The route I've ended up taking so far is to use NO_COLOR and some heuristics to figure out whether to do any fancy stuff, so it's very clear and easy how to opt out of it, and it applied globally! It does mean that it's a bit all-or-nothing, but I got some feedback that relying on more bespoke or obscure env vars might make it harder to discover? In any case, I definitely want the "narrated" output to be readable (and hearable), so I think turning NO_COLOR into a big hammer by default is ok?
re: CLICOLOR
: I didn't know about that one! I'll be sure to add support for that alongside NO_COLOR.
Finally,
from miette.
Related Issues (20)
- Allow the inner source type of a `NamedSource` to be borrowed directly HOT 1
- More controlability for the `label` HOT 5
- `Severity` should implement `Ord`
- Allow spans in `help` to provide structured suggestions HOT 3
- Backtrace and Spantrace support HOT 5
- Update miette-derive syn dependency to syn 2 HOT 2
- Still print the name of the SourceCode even if all the labels are invalid
- How to manually collect and print errors HOT 2
- Add source slices HOT 1
- Expose access to line and column info from SourceSpan HOT 3
- Add struct for dynamic creation of diagnostics HOT 2
- Use serde HOT 4
- Constify `SourceOffset` and `SourceSpan` HOT 1
- Add `FixIt` support
- Fix overlapping labels HOT 1
- Make "Error: " prefix in error messages configurable/optional HOT 5
- Do I need to fill the source content of NamedSource by myself? HOT 2
- `#[source]` does not work on `Box<dyn Error + Send + Sync>`
- Unexpected behaviour on empty span HOT 2
- Unable to work with &Result<T, E>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miette.