19
19
//! `terminal-colorsaurus` works with most modern terminals and has been [tested extensively](`terminal_survey`).
20
20
//! It's also really good at [detecting](`feature_detection`) when querying for the terminal's colors is not supported.
21
21
//!
22
+ //! ## Caveats
23
+ //! Extra care needs to be taken on Unix if your program might share
24
+ //! the terminal with another program. This might be the case
25
+ //! if you expect your output to be used with a pager e.g. `your_program` | `less`.
26
+ //! In that case, a race condition exists because the pager will also set the terminal to raw mode.
27
+ //! The `pager` example shows a heuristic to deal with this issue.
28
+ //!
22
29
//! ## Example 1: Test If the Terminal Uses a Dark Background
23
30
//! ```no_run
24
31
//! use terminal_colorsaurus::{color_scheme, ColorScheme};
@@ -171,7 +178,6 @@ macro_rules! impl_query_fn {
171
178
172
179
impl_query_fn ! {
173
180
/// Detects if the terminal is dark or light.
174
- #[ doc = include_str!( "../doc/caveats.md" ) ]
175
181
#[ doc( alias = "theme" ) ]
176
182
pub fn color_scheme( ) -> Result <ColorScheme >;
177
183
@@ -182,7 +188,6 @@ impl_query_fn! {
182
188
183
189
impl_query_fn ! {
184
190
/// Queries the terminal for it's color scheme (foreground and background color).
185
- #[ doc = include_str!( "../doc/caveats.md" ) ]
186
191
pub fn color_palette( ) -> Result <ColorPalette >;
187
192
188
193
pub fn color_palette_with_options( options: QueryOptions ) -> Result <ColorPalette > {
@@ -193,7 +198,6 @@ impl_query_fn! {
193
198
impl_query_fn ! {
194
199
/// Queries the terminal for it's foreground color. \
195
200
/// If you also need the background color it is more efficient to use [`color_palette`] instead.
196
- #[ doc = include_str!( "../doc/caveats.md" ) ]
197
201
#[ doc( alias = "fg" ) ]
198
202
pub fn foreground_color( ) -> Result <Color >;
199
203
@@ -205,7 +209,6 @@ impl_query_fn! {
205
209
impl_query_fn ! {
206
210
/// Queries the terminal for it's background color. \
207
211
/// If you also need the foreground color it is more efficient to use [`color_palette`] instead.
208
- #[ doc = include_str!( "../doc/caveats.md" ) ]
209
212
#[ doc( alias = "fg" ) ]
210
213
pub fn background_color( ) -> Result <Color >;
211
214
0 commit comments