#terminal #hyperlink #detect #rendering #whether #stream #families

supports-hyperlinks

Detects whether a terminal supports rendering hyperlinks

7 stable releases

new 3.1.0 Nov 26, 2024
3.0.0 Feb 4, 2024
2.1.0 Apr 18, 2023
2.0.0 Mar 13, 2023
1.2.0 Sep 16, 2021

#126 in Command-line interface

Download history 107864/week @ 2024-08-06 107914/week @ 2024-08-13 112246/week @ 2024-08-20 109079/week @ 2024-08-27 119610/week @ 2024-09-03 118641/week @ 2024-09-10 106169/week @ 2024-09-17 122286/week @ 2024-09-24 121620/week @ 2024-10-01 106394/week @ 2024-10-08 102467/week @ 2024-10-15 105832/week @ 2024-10-22 103209/week @ 2024-10-29 100751/week @ 2024-11-05 109606/week @ 2024-11-12 104469/week @ 2024-11-19

434,990 downloads per month
Used in 197 crates (17 directly)

Apache-2.0

9KB

Detects whether the current terminal supports hyperlinks in terminal emulators.

It tries to detect and support all known terminals and terminal families that support this. If a declaration is wrong, missing, or could be improved, please send a PR!

Example

The API is super simple!

use supports_hyperlinks::Stream;

if supports_hyperlinks::on(Stream::Stdout) {
    println!("This terminal supports hyperlinks on stdout");
} else {
    println!("No hyperlinks, please");
}

And that's it!

You may set the FORCE_HYPERLINK environment variable to force supports-hyperlinks to return true for its checks. If the value is 0, this will force it to be false, instead.

MSRV

The minimum supported Rust version is 1.70.0.

No runtime deps