summaryrefslogtreecommitdiff
path: root/js/colors.ts
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-10-04 20:28:51 -0400
committerGitHub <noreply@github.com>2019-10-04 20:28:51 -0400
commitb81e5db17aa8b3088d6034ddf86b79c69410f012 (patch)
tree579e4c23d60d1b0d038156bc28a04f74ea87b2f0 /js/colors.ts
parent9049213867d30f7df090a83b6baf3e0717a4d2d2 (diff)
Merge deno_cli_snapshots into deno_cli (#3064)
Diffstat (limited to 'js/colors.ts')
-rw-r--r--js/colors.ts40
1 files changed, 0 insertions, 40 deletions
diff --git a/js/colors.ts b/js/colors.ts
deleted file mode 100644
index 9937bdb57..000000000
--- a/js/colors.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-
-// TODO(kitsonk) Replace with `deno_std/colors/mod.ts` when we can load modules
-// which end in `.ts`.
-
-import { noColor } from "./deno.ts";
-
-interface Code {
- open: string;
- close: string;
- regexp: RegExp;
-}
-
-const enabled = !noColor;
-
-function code(open: number, close: number): Code {
- return {
- open: `\x1b[${open}m`,
- close: `\x1b[${close}m`,
- regexp: new RegExp(`\\x1b\\[${close}m`, "g")
- };
-}
-
-function run(str: string, code: Code): string {
- return enabled
- ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
- : str;
-}
-
-export function bold(str: string): string {
- return run(str, code(1, 22));
-}
-
-export function yellow(str: string): string {
- return run(str, code(33, 39));
-}
-
-export function cyan(str: string): string {
- return run(str, code(36, 39));
-}