diff --git a/TrueColorConsole/VTConsole.cs b/TrueColorConsole/VTConsole.cs
index 75ff896..314ef67 100644
--- a/TrueColorConsole/VTConsole.cs
+++ b/TrueColorConsole/VTConsole.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
@@ -405,6 +405,61 @@ public static void WriteConcat(params object[] objects)
Console.Write(string.Concat(objects));
}
- #endregion
- }
-}
\ No newline at end of file
+
+ ///
+ /// Writes a file hyperlink to the console (if it supports OSC 8 sequences)
+ ///
+ ///
+ /// Title to show for the link
+ ///
+ ///
+ /// The link, normally https:// http:// file://
+ ///
+ [PublicAPI]
+ public static void WriteFileLink(String title, String file_path) {
+ Console.Write(GetFileLinkStr(title, file_path));
+ }
+ ///
+ /// Writes a hyperlink to the console (if it supports OSC 8 sequences)
+ ///
+ ///
+ /// Title to show for the link
+ ///
+ ///
+ /// The link, normally https:// http:// file://
+ ///
+ [PublicAPI]
+ public static void WriteLink(String title, String link) {
+ Console.Write(GetLinkStr(title,link));
+ }
+ ///
+ /// Get a hyperlink string sequence in OSC 8 format
+ ///
+ ///
+ /// Title to show for the link
+ ///
+ ///
+ /// Path to the file
+ ///
+ [PublicAPI]
+ public static string GetFileLinkStr(String title, String file_path) {
+ return $"{LINK}{new Uri(new Uri("file://"), file_path).AbsoluteUri}{ST}{title}{LINK}{ST}";//this file:// hinting is required for linux
+ }
+ ///
+ /// Get a hyperlink string sequence in OSC 8 format
+ ///
+ ///
+ /// Title to show for the link
+ ///
+ ///
+ /// The link, normally https:// http:// file://
+ ///
+ [PublicAPI]
+ public static string GetLinkStr(String title, String link) {
+ return $"{LINK}{link}{ST}{title}{LINK}{ST}";
+ }
+ private const string LINK = ESC + "]8;;";
+ private const string ST = ESC + "\\";
+ #endregion
+ }
+}