1 //! Accessibility mode functions.
5 //! `Ouch`'s default output contains symbols which make it visually easier to
6 //! read, but harder for people who are visually impaired and rely on
7 //! text-to-voice readers.
9 //! On top of that, people who use text-to-voice tools can't easily skim
10 //! through verbose lines of text, so they strongly benefit from fewer lines
15 //! To tackle that, `Ouch` has an accessibility mode that filters out most of
16 //! the verbose logging, displaying only the most important pieces of
19 //! Accessible mode also changes how logs are displayed, to remove symbols
20 //! which are "noise" to text-to-voice tools and change formatting of error
23 //! # Are impaired people actually benefiting from this?
25 //! So far we don't know. Most CLI tools aren't accessible, so we can't expect
26 //! many impaired people to be using the terminal and CLI tools, including
29 //! I consider this to be an experiment, and a tiny step towards the right
30 //! direction, `Ouch` shows that this is possible and easy to do, hopefully
31 //! we can use our experience to later create guides or libraries for other
34 use once_cell::sync::OnceCell;
36 /// Global flag for accessible mode.
37 pub static ACCESSIBLE: OnceCell<bool> = OnceCell::new();
39 /// Check if `Ouch` is running in accessible mode.
41 /// Check the module-level documentation for more details.
42 pub fn is_running_in_accessible_mode() -> bool {
43 ACCESSIBLE.get().copied().unwrap_or(false)
46 /// Set the value of the global [`ACCESSIBLE`] flag.
48 /// Check the module-level documentation for more details.
49 pub fn set_accessible(value: bool) {
50 if ACCESSIBLE.get().is_none() {
51 ACCESSIBLE.set(value).unwrap();