Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import {
FileSystemSchematicDescription,
NodeWorkflow,
} from '@angular-devkit/schematics/tools';
import { figures } from 'listr2';
import { SpawnSyncReturns } from 'node:child_process';
import * as semver from 'semver';
import { subscribeToWorkflow } from '../../../command-builder/utilities/schematic-workflow';
import { colors, figures } from '../../../utilities/color';
import { colors } from '../../../utilities/color';
import { assertIsError } from '../../../utilities/error';
import { writeErrorToLogFile } from '../../../utilities/log-file';
import { formatFiles } from '../../../utilities/prettier';
Expand Down
17 changes: 16 additions & 1 deletion packages/angular/cli/src/utilities/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,23 @@
*/

import { WriteStream } from 'node:tty';
import { styleText } from 'node:util';

export { color as colors, figures } from 'listr2';
export const colors = Object.freeze({
black: (text: string) => styleText('black', text),
blue: (text: string) => styleText('blue', text),
bold: (text: string) => styleText('bold', text),
cyan: (text: string) => styleText('cyan', text),
dim: (text: string) => styleText('dim', text),
gray: (text: string) => styleText('gray', text),
green: (text: string) => styleText('green', text),
italic: (text: string) => styleText('italic', text),
magenta: (text: string) => styleText('magenta', text),
red: (text: string) => styleText('red', text),
underline: (text: string) => styleText('underline', text),
white: (text: string) => styleText('white', text),
yellow: (text: string) => styleText('yellow', text),
});
Comment thread
clydin marked this conversation as resolved.

export function supportColor(stream: NodeJS.WritableStream = process.stdout): boolean {
if (stream instanceof WriteStream) {
Expand Down