本文整理汇总了TypeScript中ansi-colors.magenta函数的典型用法代码示例。如果您正苦于以下问题:TypeScript magenta函数的具体用法?TypeScript magenta怎么用?TypeScript magenta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了magenta函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: mapFile
function mapFile(file: vinyl, cb: map.INewDataCallback): void {
const filepath = colors.magenta(path.relative(process.cwd(), file.path));
const formatted = format(filepath);
if (formatted) {
log(formatted);
}
cb(null, file);
}
示例2: done
stream.on('end', () => {
chai.expect(logStub).to.have.been.calledWith(`Hello ${colors.magenta(path.relative(process.cwd(), filepath))}`);
done();
});
示例3:
const showErrorCount = (count: number, type: string) => {
if (count === 0) return;
console.log('TypeScript:', colors.magenta(count.toString()), (type !== '' ? type + ' ' : '') + (count === 1 ? 'error' : 'errors'));
hasError = true;
};
示例4:
import * as colors from 'ansi-colors';
let s: string;
s = colors.bgblack("hello");
s = colors.bgblue("hello");
s = colors.bgcyan("hello");
s = colors.bggreen("hello");
s = colors.bgmagenta("hello");
s = colors.bgred("hello");
s = colors.bgwhite("hello");
s = colors.bgyellow("hello");
s = colors.black("hello");
s = colors.blue("hello");
s = colors.bold("hello");
s = colors.cyan("hello");
s = colors.dim("hello");
s = colors.gray("hello");
s = colors.green("hello");
s = colors.grey("hello");
s = colors.hidden("hello");
s = colors.inverse("hello");
s = colors.italic("hello");
s = colors.magenta("hello");
s = colors.red("hello");
s = colors.reset("hello");
s = colors.strikethrough("hello");
s = colors.underline("hello");
s = colors.white("hello");
s = colors.yellow("hello");
示例5: log
function log(): void {
const errors = _.flatten(allErrors);
const seen = new Set<string>();
errors.map(err => {
if (!seen.has(err)) {
seen.add(err);
fancyLog(`${ansiColors.red('Error')}: ${err}`);
}
});
const regex = /^([^(]+)\((\d+),(\d+)\): (.*)$/;
const messages = errors
.map(err => regex.exec(err))
.filter(match => !!match)
.map(x => x as string[])
.map(([, path, line, column, message]) => ({ path, line: parseInt(line), column: parseInt(column), message }));
try {
fs.writeFileSync(buildLogPath, JSON.stringify(messages));
} catch (err) {
//noop
}
fancyLog(`Finished ${ansiColors.green('compilation')} with ${errors.length} errors after ${ansiColors.magenta((new Date().getTime() - startTime!) + ' ms')}`);
}
示例6: logSuccess
export function logSuccess(file: WorkFile) {
console.log(c.magenta(basename(file.distScss)), c.green(c.symbols.check));
}