#terminal #hyperlink #detect #whether #rendering #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

#79 in Command-line interface

Download history 35355/week @ 2023-12-23 65658/week @ 2023-12-30 71413/week @ 2024-01-06 88623/week @ 2024-01-13 114414/week @ 2024-01-20 127799/week @ 2024-01-27 149536/week @ 2024-02-03 138802/week @ 2024-02-10 137183/week @ 2024-02-17 143065/week @ 2024-02-24 141668/week @ 2024-03-02 109072/week @ 2024-03-09 120103/week @ 2024-03-16 111733/week @ 2024-03-23 107569/week @ 2024-03-30 88329/week @ 2024-04-06

446,520 downloads per month
Used in 116 crates (9 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