当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript chalk.hex函数代码示例

本文整理汇总了TypeScript中chalk.hex函数的典型用法代码示例。如果您正苦于以下问题:TypeScript hex函数的具体用法?TypeScript hex怎么用?TypeScript hex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hex函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

    .action( function (lambdaFile: string, functionName: string, options: any) {
        if (options.secure) {
            console.log("You are in secure mode, requests must include the bespoken-key in the query or the headers");
            console.log("");
            console.log("Your public URL for accessing your local service with bespoken-key in the query:");
            console.log(chalk.hex(LoggingHelper.LINK_COLOR)(URLMangler.manglePipeToPath(Global.config().sourceID(), Global.config().secretKey())));
            console.log("");
        } else {
            console.log("Your public URL for accessing your local service:");
            console.log(chalk.hex(LoggingHelper.LINK_COLOR)(URLMangler.manglePipeToPath(Global.config().sourceID())));
            console.log("");
        }

        let proxy: BSTProxy = BSTProxy.lambda(lambdaFile, functionName);
        handleOptions(proxy, options);
        proxy.start();
    });
开发者ID:bespoken,项目名称:bst,代码行数:17,代码来源:bst-proxy.ts

示例2:

        speaker.launched(function (errorInLaunch: any, response: any, request: any) {
            if (errorInLaunch) {
                console.error(chalk.red("Error: " + errorInLaunch));
                return;
            }

            const jsonPretty = JSON.stringify(response, null, 4);
            console.log("Request:");
            console.log(chalk.hex(LoggingHelper.REQUEST_COLOR)(JSON.stringify(request, null, 4)));
            console.log("");
            console.log("Response:");
            console.log(chalk.cyan(jsonPretty));
            console.log("");
        });
开发者ID:bespoken,项目名称:bst,代码行数:14,代码来源:bst-launch.ts

示例3: function

            speaker.intended(intentName, slots, function(error: any, response: any, request: any) {
                console.log("Intended: " + intentName);
                console.log("");
                if (request) {
                    console.log("Request:");
                    console.log(chalk.hex(LoggingHelper.REQUEST_COLOR)(JSON.stringify(request, null, 4)));
                    console.log("");
                }

                if (error) {
                    console.log(chalk.red("Error: " + error.message));
                    return;
                }
                const jsonPretty = JSON.stringify(response, null, 4);
                console.log("Response:");
                console.log(chalk.cyan(jsonPretty));
                console.log("");
            });
开发者ID:bespoken,项目名称:bst,代码行数:18,代码来源:bst-intend.ts

示例4: function

        speaker.spoken(utterance, function(error: any, response: any, request: any) {
            console.log("Spoke: " + utterance);
            console.log("");
            if (request) {
                console.log("Request:");
                console.log(chalk.hex(LoggingHelper.REQUEST_COLOR)(JSON.stringify(request, null, 4)));
                console.log("");
            }

            if (error) {
                console.log(chalk.red("Error: " + error.message));
                return;
            }
            const jsonPretty = JSON.stringify(response, null, 4);
            console.log("Response:");
            console.log(chalk.cyan(jsonPretty));
            console.log("");
        });
开发者ID:bespoken,项目名称:bst,代码行数:18,代码来源:bst-utter.ts

示例5: init

  public init(title: string, total: number) {
    if (this.bar) {
      this.terminate();
    }

    // Intentionally a noop because node-progress doesn't work well in non-TTY
    // environments
    if (!process.stdout.isTTY) {
      return;
    }

    this.bar = new ProgressBar(`:bar ${title} (:percent)`, {
      total,
      complete: chalk.hex("#0366d6")("█"),
      incomplete: chalk.enabled ? chalk.gray("█") : "░",
      clear: true,

      // terminal columns - package name length - additional characters length
      width: 20,
    });
  }
开发者ID:lerna,项目名称:lerna-changelog,代码行数:21,代码来源:progress-bar.ts

示例6: startsWith

      .map(({ value, color }) => {
        const colored = startsWith(color, "#")
          ? chalk.hex(color)
          : chalk.keyword(color || "white");

        switch (value) {
          case GraphSymbol.Empty:
            return " ";

          case GraphSymbol.Branch:
            return colored("|");

          case GraphSymbol.BranchOpen:
            return colored("\\");

          case GraphSymbol.BranchMerge:
            return colored("/");

          case GraphSymbol.Commit:
            return colored("*");

          default:
            const commit = value as GraphCommit;
            let text = ` ${colored(commit.hash)} `;

            if (commit.refs.length > 0) {
              const parsedRefs = commit.refs.map((ref) => {
                return ref === "HEAD" ? chalk.bold(ref) : ref;
              });
              text += chalk.red(`(${parsedRefs.join(", ")})`);
              text += " ";
            }

            text += `${colored(commit.message)}`;

            return text;
        }
      })
开发者ID:nicoespeon,项目名称:gitgraph.js,代码行数:38,代码来源:console-graph-logger.ts

示例7:

import npmLog from 'npmlog';
import prettyTime from 'pretty-hrtime';
import chalk from 'chalk';

export const colors = {
  pink: chalk.hex('F1618C'),
  purple: chalk.hex('B57EE5'),
  orange: chalk.hex('F3AD38'),
  green: chalk.hex('A2E05E'),
  blue: chalk.hex('6DABF5'),
  red: chalk.hex('F16161'),
  gray: chalk.gray,
};

export const logger = {
  info: (message: string): void => npmLog.info('', message),
  plain: (message: string): void => console.log(message),
  line: (count: number = 1): void => console.log(`${Array(count - 1).fill('\n')}`),
  warn: (message: string): void => npmLog.warn('', message),
  error: (message: string): void => npmLog.error('', message),
  trace: ({ message, time }: { message: string; time: [number, number] }): void =>
    npmLog.info('', `${message} (${colors.purple(prettyTime(time))})`),
};

export { npmLog as instance };
开发者ID:chinmaymoharir,项目名称:storybook,代码行数:25,代码来源:index.ts

示例8: run

export async function run() {
  const yargs = require("yargs");

  const argv = yargs
    .usage("lerna-changelog [options]")
    .options({
      from: {
        type: "string",
        desc: "A git tag or commit hash that determines the lower bound of the range of commits",
        defaultDescription: "latest tagged commit",
      },
      to: {
        type: "string",
        desc: "A git tag or commit hash that determines the upper bound of the range of commits",
      },
      "tag-from": {
        hidden: true,
        type: "string",
        desc: "A git tag that determines the lower bound of the range of commits (defaults to last available)",
      },
      "tag-to": {
        hidden: true,
        type: "string",
        desc: "A git tag that determines the upper bound of the range of commits",
      },
      "next-version": {
        type: "string",
        desc: "The name of the next version",
        default: "Unreleased",
      },
      "next-version-from-metadata": {
        type: "boolean",
        desc: "Infer the name of the next version from package metadata",
        default: false,
      },
    })
    .example(
      "lerna-changelog",
      'create a changelog for the changes after the latest available tag, under "Unreleased" section'
    )
    .example(
      "lerna-changelog --from=0.1.0 --to=0.3.0",
      "create a changelog for the changes in all tags within the given range"
    )
    .epilog("For more information, see https://github.com/lerna/lerna-changelog")
    .wrap(Math.min(100, yargs.terminalWidth()))
    .parse();

  let options = {
    tagFrom: argv["from"] || argv["tag-from"],
    tagTo: argv["to"] || argv["tag-to"],
  };

  try {
    let config = loadConfig({
      nextVersionFromMetadata: argv["next-version-from-metadata"],
    });

    if (argv["next-version"]) {
      config.nextVersion = argv["next-version"];
    }

    let result = await new Changelog(config).createMarkdown(options);

    let highlighted = highlight(result, {
      language: "Markdown",
      theme: {
        section: chalk.bold,
        string: chalk.hex("#0366d6"),
        link: chalk.dim,
      },
    });

    console.log(highlighted);
  } catch (e) {
    if (e instanceof ConfigurationError) {
      console.log(chalk.red(e.message));
    } else {
      console.log(chalk.red(e.stack));
    }
  }
}
开发者ID:lerna,项目名称:lerna-changelog,代码行数:82,代码来源:cli.ts

示例9: Command

import upload from './cmds/upload';
import chalk from 'chalk';

const program = new Command();

// TODO
// bootstrap:
// Check whether config.json exists
// If config.json exists, import it
// Ask which categories in .runtimeconfig.json should be imported
//   - Ask which new categories (names) should be created
//   - Ask for the slug for each category
//   - Add name/slug objects to .runtimeconfig.json
// Save .runtimeconfig.json

console.log(`Gettin' spooky 👻  with ${chalk.hex('#fedc5d').bold('poltergeist')}`);

program.version('0.0.0', '-v, --version');

program
  .command('bootstrap [destination]')
  .description('bootstrap project')
  .action(bootstrap);

program
  .command('configure')
  .description('configure project')
  .action(configure);

program
  .command('backup [destination]')
开发者ID:accosine,项目名称:poltergeist,代码行数:31,代码来源:cli.ts


注:本文中的chalk.hex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。