Skip to content

Commit

Permalink
Restore previous FORCE_COLOR=0 behavior (#16362)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 19, 2024
1 parent 50488e7 commit f96d8a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/babel-code-frame/src/index.ts
@@ -1,7 +1,13 @@
import highlight, { shouldHighlight } from "@babel/highlight";

import colors, { createColors } from "picocolors";
import _colors, { createColors } from "picocolors";
import type { Colors, Formatter } from "picocolors/types";
// See https://github.com/alexeyraspopov/picocolors/issues/62
const colors =
typeof process === "object" &&
(process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false")
? createColors(false)
: _colors;

const compose: <T, U, V>(f: (gv: U) => V, g: (v: T) => U) => (v: T) => V =
(f, g) => v =>
Expand Down
8 changes: 7 additions & 1 deletion packages/babel-highlight/src/index.ts
Expand Up @@ -8,8 +8,14 @@ import {
isKeyword,
} from "@babel/helper-validator-identifier";

import colors, { createColors } from "picocolors";
import _colors, { createColors } from "picocolors";
import type { Colors, Formatter } from "picocolors/types";
// See https://github.com/alexeyraspopov/picocolors/issues/62
const colors =
typeof process === "object" &&
(process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false")
? createColors(false)
: _colors;

const compose: <T, U, V>(f: (gv: U) => V, g: (v: T) => U) => (v: T) => V =
(f, g) => v =>
Expand Down

0 comments on commit f96d8a1

Please sign in to comment.