本文整理汇总了TypeScript中ansi-colors.gray函数的典型用法代码示例。如果您正苦于以下问题:TypeScript gray函数的具体用法?TypeScript gray怎么用?TypeScript gray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gray函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
error: (error: TypeScriptError, typescript: typeof ts) => {
console.log('[' + colors.gray('gulp-typescript') + '] '
+ colors.bgRed(error.diagnostic.code + '')
+ ' ' + colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'))
);
if (error.tsFile) {
console.log('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + colors.gray(':'));
const lines = error.tsFile.text.split(/(?:\r\n|\r|\n)/);
const logLine = (lineIndex: number, errorStart: number, errorEnd?: number) => {
const line = lines[lineIndex];
if (errorEnd === undefined) errorEnd = line.length;
console.log('> ' + colors.gray('[' + lineIndex + '] ')
+ line.substring(0, errorStart)
+ colors.red(line.substring(errorStart, errorEnd))
+ line.substring(errorEnd)
);
}
for (let i = error.startPosition.line; i <= error.endPosition.line; i++) {
logLine(i,
i === error.startPosition.line ? error.startPosition.character - 1 : 0,
i === error.endPosition.line ? error.endPosition.character - 1 : undefined
);
}
}
},
示例2: existsSync
.forEach((key: string) => {
if (key === 'lang') {
const lang: string = namedArgs[key] as string;
const i18nFilePath = `${Config.LOCALE_DEST}/messages.${lang}.xlf`;
const isExists = existsSync(i18nFilePath);
if (isExists) {
args.push('--i18nFile', i18nFilePath);
args.push('--locale', lang);
args.push('--i18nFormat', 'xlf');
} else {
log(colors.gray('Translation file is not found'), colors.yellow(i18nFilePath));
log(colors.gray(`Use 'npm run i18n' command to create your translation file`));
}
} else {
args.push('--' + key, namedArgs[key]);
}
});
示例3:
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");