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

supports-hyperlinks

Detects whether a terminal supports rendering hyperlinks

6 stable releases

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

#73 in Command-line interface

Download history 116339/week @ 2024-06-26 111121/week @ 2024-07-03 105140/week @ 2024-07-10 111693/week @ 2024-07-17 114242/week @ 2024-07-24 112277/week @ 2024-07-31 109032/week @ 2024-08-07 108151/week @ 2024-08-14 112724/week @ 2024-08-21 107644/week @ 2024-08-28 122408/week @ 2024-09-04 116130/week @ 2024-09-11 108689/week @ 2024-09-18 122462/week @ 2024-09-25 122136/week @ 2024-10-02 84817/week @ 2024-10-09

457,222 downloads per month
Used in 177 crates (15 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