@travetto/terminal 7.1.4 → 8.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/style.ts +6 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/terminal",
3
- "version": "7.1.4",
3
+ "version": "8.0.0-alpha.0",
4
4
  "type": "module",
5
5
  "description": "General terminal support",
6
6
  "keywords": [
@@ -25,7 +25,7 @@
25
25
  "directory": "module/terminal"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/runtime": "^7.1.4",
28
+ "@travetto/runtime": "^8.0.0-alpha.0",
29
29
  "chalk": "^5.6.2"
30
30
  },
31
31
  "travetto": {
package/src/style.ts CHANGED
@@ -22,6 +22,8 @@ const toLinear = (v: number): number => {
22
22
  return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
23
23
  };
24
24
 
25
+ const ESC = '\x1b';
26
+
25
27
  export class StyleUtil {
26
28
 
27
29
  /** Compute RGB values for ANSI 256 color code */
@@ -139,4 +141,8 @@ export class StyleUtil {
139
141
  };
140
142
  }
141
143
 
144
+ /** Make a URL link */
145
+ static link(text: string, url: string): string {
146
+ return `${ESC}]8;;${url}${ESC}\\${text}${ESC}]8;;${ESC}\\`;
147
+ }
142
148
  }