本文整理汇总了TypeScript中colors.magenta函数的典型用法代码示例。如果您正苦于以下问题:TypeScript magenta函数的具体用法?TypeScript magenta怎么用?TypeScript magenta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了magenta函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.setupConfig(yargs.argv.config).then(options => {
options = Object.assign({}, this.defaultOptions, options);
if (options.addClient) {
const client = {
appId: this.createAppId(),
key: this.createApiKey()
};
options.clients.push(client);
console.log('appId: ' + colors.magenta(client.appId));
console.log('key: ' + colors.magenta(client.key));
}
if (options.corsAllow) {
options.apiOriginAllow.allowCors = true;
options.apiOriginAllow.allowOrigin = options.allowOrigin;
options.apiOriginAllow.allowMethods = options.allowMethods;
options.apiOriginAllow.allowHeaders = options.allowHeaders;
}
this.saveConfig(options).then(file => {
console.log('Configuration file saved. Run ' + colors.magenta.bold('laravel-echo-server start' + (file != 'laravel-echo-server.json' ? ' --config="' + file + '"' : '')) + ' to run server.');
process.exit();
}, error => {
console.error(colors.error(error));
});
}, error => console.error(error));
示例2: async
const linkDist = async (pckg: IPackage) => {
const modulesPackagePath = path.join(cwd, nodeModulesDir, pckg.name);
const packageDistPath = path.join(pckg.path, packageDistDir);
try {
await pathExists(modulesPackagePath);
console.info(colors.green(`${modulesPackagePath} exists`));
try {
await pathIsSymLink(modulesPackagePath);
console.info(colors.green(`${modulesPackagePath} is a symbolic link`));
} catch (e) {
console.info(colors.magenta(`${modulesPackagePath} is not a symbolic link`));
await removePath(packageDistPath);
await copyPath(modulesPackagePath, packageDistPath);
await removePath(modulesPackagePath);
await symLinkPath(packageDistPath, modulesPackagePath);
}
} catch (e) {
console.info(colors.magenta(`${modulesPackagePath} does not exist`));
try {
await pathExists(packageDistPath);
console.info(colors.green(`${packageDistPath} exists`));
await symLinkPath(packageDistPath, modulesPackagePath);
} catch (e) {
console.info(colors.magenta(`${packageDistPath} does not exist: create it`));
await createPath(packageDistPath);
await symLinkPath(packageDistPath, modulesPackagePath);
}
}
};
示例3: clientAdd
/**
* Add a registered referrer.
*
* @param {Object} yargs
* @return {void}
*/
clientAdd(yargs): void {
var options = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
var appId = yargs.argv._[1] || this.createAppId();
options.clients = options.clients || [];
if (appId) {
var index = null;
var client = options.clients.find((client, i) => {
index = i;
return client.appId == appId;
});
if (client) {
client.key = this.createApiKey();
options.clients[index] = client;
console.log(colors.green('API Client updated!'));
} else {
client = {
appId: appId,
key: this.createApiKey()
};
options.clients.push(client);
console.log(colors.green('API Client added!'));
}
console.log(colors.magenta('appId: ' + client.appId));
console.log(colors.magenta('key: ' + client.key))
this.saveConfig(options);
}
}
示例4: async
Coinjar: async () => {
const rates = await rp({ uri: 'https://api.coinjar.com/v3/exchange_rates', json: true });
const usd = parseFloat(rates.exchange_rates.BTCUSD.midpoint);
const aud = parseFloat(rates.exchange_rates.BTCAUD.midpoint);
return {
usd: {
raw: usd,
formatted: colors.red(`$${usd.toFixed(2)}USD`)
},
aud: {
raw: aud,
formatted: colors.magenta(`$${aud.toFixed(2)}AUD`)
},
notifier: () => {
function notify(operator, target, price) {
notifier.notify({
title: `CoinJar Midpoint ${operator} $${target}`,
sound: true,
message: price
});
player.play('Morning_Flower.mp3', function(err) {
//console.log(`Could not play sound! Error: ${err}`);
});
}
if (aud <= priceLow) {
notify('<=', priceLow, aud);
} else if (aud >= priceHigh) {
notify('=>', priceHigh, aud);
}
}
};
},
示例5: clientAdd
/**
* Add a registered referrer.
*
* @param {object} yargs
* @return {void}
*/
clientAdd(yargs): void {
yargs.option({
config: {
type: 'string',
describe: 'The config file to use.',
},
dir: {
type: 'string',
describe: 'The working directory to use.',
}
});
const options = this.readConfigFile(this.getConfigFile(yargs.argv.config, yargs.argv.dir));
const appId = yargs.argv._[1] || this.createAppId();
options.clients = options.clients || [];
if (appId) {
let index = null;
let client = options.clients.find((client, i) => {
index = i;
return client.appId == appId;
});
if (client) {
client.key = this.createApiKey();
options.clients[index] = client;
console.log(colors.green('API Client updated!'));
} else {
client = {
appId: appId,
key: this.createApiKey()
};
options.clients.push(client);
console.log(colors.green('API Client added!'));
}
console.log(colors.magenta('appId: ' + client.appId));
console.log(colors.magenta('key: ' + client.key))
this.saveConfig(options);
}
}
示例6: applyColor
function applyColor(message: string, color: Color): string {
if (!message) return;
if (!color) return message;
switch (color) {
case Color.black: return colors.black(message);
case Color.red: return colors.red(message);
case Color.green: return colors.green(message);
case Color.yellow: return colors.yellow(message);
case Color.blue: return colors.blue(message);
case Color.magenta: return colors.magenta(message);
case Color.cyan: return colors.cyan(message);
case Color.white: return colors.white(message);
case Color.grey: return colors.grey(message);
default: throw new Error('Invalid Color');
}
}
示例7: verboset
export function verboset(str: string, ...args: Array<any>): void {
if (logLevel >= LogLevel.verbose){
console.log(colors.magenta('VERBOSE ') + str, ...args);
}
}