How to use github-colors - 8 common examples

To help you get started, we’ve selected a few github-colors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IonicaBizau / node-gh-polyglot / build / client.js View on Github external
;

const TEMPLATE = "(function (root) {\n"
               + "  var GitHubColors = __GITHUB_COLORS__;\n"
               + "  __GITHUB_POLYGLOT__\n"
               + "})(window);";

// Configurations
GitHubColors.init();

var ghPolyglot = Fs.readFileSync(__dirname + "/../lib/index.js", "utf-8")
  , lines = ghPolyglot.split("\n")
  , replace = {
        __GITHUB_POLYGLOT__: lines.slice(lines.indexOf("/**")).join("\n")
      , __GITHUB_COLORS__: "{ get: " + GitHubColors.get.toString() + ",\n"
                         + "colors: " + JSON.stringify(GitHubColors.colors) + "}"
    }
  , client = TEMPLATE
  ;

Object.keys(replace).forEach(function (c) {
    client = client.replace(new RegExp(c), replace[c]);
});

client = client.replace("module.exports = ", "root.GitHubPolyglot = ");
client = client.replace("this.init();", "");

Fs.writeFileSync(__dirname + "/../dist/gh-polyglot.js", client);
Fs.writeFileSync(__dirname + "/../dist/gh-polyglot.min.js", UglifyJS.minify(client, { fromString: true }).code);
github IonicaBizau / node-gh-polyglot / build / client.js View on Github external
// This file generates the client script
// Dependencies
var Fs = require("fs")
  , GitHubColors = require("github-colors")
  , UglifyJS = require("uglify-js")
  ;

const TEMPLATE = "(function (root) {\n"
               + "  var GitHubColors = __GITHUB_COLORS__;\n"
               + "  __GITHUB_POLYGLOT__\n"
               + "})(window);";

// Configurations
GitHubColors.init();

var ghPolyglot = Fs.readFileSync(__dirname + "/../lib/index.js", "utf-8")
  , lines = ghPolyglot.split("\n")
  , replace = {
        __GITHUB_POLYGLOT__: lines.slice(lines.indexOf("/**")).join("\n")
      , __GITHUB_COLORS__: "{ get: " + GitHubColors.get.toString() + ",\n"
                         + "colors: " + JSON.stringify(GitHubColors.colors) + "}"
    }
  , client = TEMPLATE
  ;

Object.keys(replace).forEach(function (c) {
    client = client.replace(new RegExp(c), replace[c]);
});

client = client.replace("module.exports = ", "root.GitHubPolyglot = ");
github kamranahmedse / githunt / src / components / filters / language-filter / index.js View on Github external
return availableLanguages.map((language, counter) => {
      const isSelectedIndex = counter === this.state.selectedIndex;

      // This will be used in making sure of the element visibility
      const refProp = isSelectedIndex ? { ref: 'activeItem' } : {};
      const languageColor = GithubColors.get(language.title) || {
        color: language.title === 'All Languages' ? 'transparent' : '#e8e8e8'
      };

      return (
        <a> this.selectLanguage(counter) }
           key={ counter }&gt;
          <span style="{{"></span>
          <span>{ language.title }</span>
        </a>
      );
    });
  }
github ghuser-io / ghuser.io / db / fetch.js View on Github external
spinner = ora(`Fetching ${ghUrl}...`).start();

      if (!db.repos[repo].fetching ||
          db.repos[repo].fetched_at &&
          new Date(db.repos[repo].fetched_at) > new Date(db.repos[repo].pushed_at)) {
        spinner.succeed(`${repo} hasn't changed`);
        return;
      }

      const ghDataJson = await fetchJson(authify(ghUrl));
      spinner.succeed(`Fetched ${ghUrl}`);

      for (let language in ghDataJson) {
        ghDataJson[language] = {
          bytes: ghDataJson[language],
          color: githubColors.get(language, true).color
        };
      }

      db.repos[repo].languages = ghDataJson;
      db.write();
    }
github ghuser-io / ghuser.io / db / fetchRepos.js View on Github external
const ghUrl = `https://api.github.com/repos/${repo}/languages`;
      spinner = ora(`Fetching ${ghUrl}...`).start();

      if (!repos[repo].fetching_since || repos[repo].fetched_at &&
          new Date(repos[repo].fetched_at) > new Date(repos[repo].pushed_at)) {
        spinner.succeed(`${repo} hasn't changed`);
        return;
      }

      const ghDataJson = await github.fetchGHJson(ghUrl, spinner);
      spinner.succeed(`Fetched ${ghUrl}`);

      for (let language in ghDataJson) {
        ghDataJson[language] = {
          bytes: ghDataJson[language],
          color: githubColors.get(language, true).color
        };
      }

      repos[repo].languages = ghDataJson;
      repos[repo].write();
    }
github kamranahmedse / githunt / src / components / repository-grid / grid-item / index.js View on Github external
render() {
    const languageColor = GithubColors.get(this.props.repository.language);

    return (
      <div>
        <div>
          <div>
            <a rel="noopener noreferrer" href="{">
              <div>
                <img src="{"> {
                       e.target.src = '/img/logo.svg';
                     } }
                     alt={ this.props.repository.owner.login }/&gt;
              </div>
              <div>
                <h5>{ this.props.repository.owner.login }</h5>
                <p>View Profile</p></div></a></div></div></div>
github kamranahmedse / githunt / src / components / repository-list / list-item / index.js View on Github external
render() {
    const languageColor = GithubColors.get(this.props.repository.language);

    return (
      <div>
        <div>
          <div>
            <h3>
              <a rel="noopener noreferrer" href="{">
                <span>{ this.props.repository.owner.login } / </span>
                { this.props.repository.name }
              </a>
            </h3>
            <p>Built by · <a rel="noopener noreferrer" href="{">{ this.props.repository.owner.login }</a> · { moment(this.props.repository.created_at).format('MMMM D YYYY') }</p>
          </div>
          <div>
            <p>{ this.props.repository.description || 'No description given.' }</p>
          </div></div></div>
github IonicaBizau / node-gh-polyglot / lib / index.js View on Github external
arrData = Object.keys(languages).map(function (cLang) {
            return {
                label: cLang
              , value: languages[cLang]
              , color: GitHubColors.get(cLang, true).color
            };
        });

github-colors

GitHub colors and file extensions mapping

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis