Skip to content

Simacoder/github-readme-stats

 
 

Repository files navigation

GitHub Readme Stats

GitHub Readme Stats

Get dynamically generated GitHub stats on your READMEs!

Tests Passing GitHub Contributors Issues GitHub pull requests

View Demo · Report Bug · Request Feature · Ask Question

Français · 简体中文 · Español · Deutsch · 日本語 · Português Brasileiro · Italiano · 한국어 . Nederlands . नेपाली . Türkçe

Love the project? Please consider donating to help it improve!

Give india logo

Are you considering supporting the project by donating? Please DO NOT!!

Instead, Help India fight the second deadly wave of COVID-19. Thousands of people are dying in India because of a lack of Oxygen & also COVID-related infrastructure.

Visit https://indiafightscorona.giveindia.org and make a small donation to help us fight COVID and overcome this crisis. A small donation goes a long way. ❤️

Features

Getting Started

GitHub Actions (Recommended)

Using GitHub Actions over the community deployment is recommended because it provides more accurate stats and 100% uptime. Simply copy-paste the following into the /.github/workflows/grs.yml file in your README repo (USERNAME/USERNAME).

name: GitHub Readme Stats
on:
  workflow_dispatch:
  schedule:
  - cron: 0 * * * *

jobs:
  grs:
    permissions: write-all
    runs-on: ubuntu-latest
    name: Generate Stats
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Generate Stats
        uses: Zo-Bro-23/grs-action@v1
        id: generate
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          options: 'username=${{ github.repository_owner }}'
      - name: Push
        uses: crazy-max/ghaction-github-pages@v3
        with:
          target_branch: grs
          build_dir: grs
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

If you want to generate multiple stats, such as top languages, wakatime, etc, you can use the following code.

name: GitHub Readme Stats
on:
  workflow_dispatch:
  schedule:
  - cron: 0 * * * *

jobs:
  stats:
    permissions: write-all
    runs-on: ubuntu-latest
    name: Stats Card
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Generate Stats
        uses: Zo-Bro-23/grs-action@v1
        id: generate
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          options: 'username=${{ github.repository_owner }}'
      - uses: actions/upload-artifact@master
        with:
          name: stats
          path: grs
  top-langs:
    permissions: write-all
    runs-on: ubuntu-latest
    name: Top Languages Card
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Generate Top Languages
        uses: Zo-Bro-23/grs-action@v1
        id: generate
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          options: 'username=${{ github.repository_owner }}'
          card: 'top-langs'
      - uses: actions/upload-artifact@master
        with:
          name: top-langs
          path: grs
  push:
    permissions: write-all
    runs-on: ubuntu-latest
    name: Push
    needs: [stats, top-langs]
    steps:
      - uses: actions/download-artifact@master
        with:
          name: stats
          path: grs
      - uses: actions/download-artifact@master
        with:
          name: top-langs
          path: grs
      - name: Push
        uses: crazy-max/ghaction-github-pages@v3
        with:
          target_branch: grs
          build_dir: grs
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

You can now include the stats in your README by using the following markdown code (replace USERNAME with your GitHub username).

[![Your GitHub stats](https://github.com/USERNAME/USERNAME/raw/grs/stats.svg)](https://github.com/anuraghazra/github-readme-stats)

You can also enable GitHub Pages on the grs branch (root) and use that URL (replace GH_PAGES_URL with your GitHub Pages URL).

[![Your GitHub stats](https://GH_PAGES_URL/stats.svg)](https://github.com/anuraghazra/github-readme-stats)

The GitHub Action accepts the following inputs:

  • token - REQUIRED - Your GitHub Personal Access Token (PAT), or any other token that GitHub accepts.
  • options - REQUIRED - Any customization options. More below. (This is the same as the query string you would pass to the API if using the community deployment)
  • card - The type of card to generate. repo, top-langs, or wakatime (leave empty for stats card).
  • path - Output path for SVG file. Relative path; include filename with .svg.
  • fetch_multipage - Experimental feature that gives more accurate stats if you have >100 repos.

Community Deployment

Copy-paste the following markdown code. Change the ?username= value to your GitHub username.

[![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)

Other cards can be included by using /api/top-langs, /api/pin, or /api/wakatime. More customization options can be added by using query parameters (&option1=value1&option2=value2&...).

GitHub Stats Card

Note Available ranks are S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%), and B+ (everyone). The values are calculated by using the cumulative distribution function using commits, contributions, issues, stars, pull requests, followers, and owned repositories. The implementation can be investigated at src/calculateRank.js.

Hiding individual stats

You can pass a query parameter &hide= to hide any specific stats with comma-separated values.

Options: &hide=stars,commits,prs,issues,contribs

?username=anuraghazra&hide=contribs,prs

Adding private contributions count to total commits count

You can add the count of all your private contributions to the total commits count by using the query parameter &count_private=true.

Note If you are deploying this project yourself, the private contributions will be counted by default. If you are using the public Vercel instance, you need to choose to share your private contributions.

Options: &count_private=true

?username=anuraghazra&count_private=true

Showing icons

To enable icons, you can pass show_icons=true in the query param, like so:

?username=anuraghazra&show_icons=true

Themes

With inbuilt themes, you can customize the look of the card without doing any manual customization.

Use &theme=THEME_NAME parameter like so :

?username=anuraghazra&show_icons=true&theme=radical

All inbuilt themes

GitHub readme stats comes with several built-in themes (e.g. dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula).

GitHub Readme Stats Themes

You can look at a preview for all available themes or checkout the theme config file & you can also contribute new themes if you like :D

Responsive Card Theme

Anurag's GitHub stats-Dark Anurag's GitHub stats-Light

Since GitHub will re-upload the cards and serve them from their CDN, we can not infer the browser/GitHub theme on the server side. There are, however, four methods you can use to create dynamics themes on the client side.

Use the transparent theme

We have included a transparent theme that has a transparent background. This theme is optimized to look good on GitHub's dark and light default themes. You can enable this theme using the &theme=transparent parameter like so:

?username=anuraghazra&show_icons=true&theme=transparent
👀 Show example

Anurag's GitHub stats

Add transparent alpha channel to a themes bg_color

You can use the bg_color parameter to make any of the available themes transparent. This is done by setting the bg_color to a colour with a transparent alpha channel (i.e. bg_color=00000000):

?username=anuraghazra&show_icons=true&bg_color=00000000
👀 Show example

Anurag's GitHub stats

Use GitHub's theme context tag

You can use GitHub's theme context tags to switch the theme based on the user GitHub theme automatically. This is done by appending #gh-dark-mode-only or #gh-light-mode-only to the end of an image URL. This tag will define whether the image specified in the markdown is only shown to viewers using a light or a dark GitHub theme:

[![Anurag's GitHub stats-Dark](https://DARK_SVG_URL/#gh-dark-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-dark-mode-only)
[![Anurag's GitHub stats-Light](https://LIGHT_SVG_URL/#gh-light-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-light-mode-only)
👀 Show example

Anurag's GitHub stats-Dark Anurag's GitHub stats-Light

Use GitHub's new media feature

You can use GitHub's new media feature in HTML to specify whether to display images for light or dark themes. This is done using the HTML <picture> element in combination with the prefers-color-scheme media feature.

<picture>
<source 
  srcset="https://DARK_SVG_URL/"
  media="(prefers-color-scheme: dark)"
/>
<source
  srcset="https://LIGHT_SVG_URL/"
  media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
/>
<img src="https://DEFAULT_SVG_URL/" />
</picture>
👀 Show example

Customization

You can customize the appearance of your cards however you wish with these parameters.

Common Options

  • title_color - Card's title color (hex color). Default: 2f80ed.
  • text_color - Body text color (hex color). Default: 434d58.
  • icon_color - Icons color if available (hex color). Default: 4c71f2.
  • border_color - Card's border color (hex color). Default: e4e2e2 (Does not apply when hide_border is enabled).
  • bg_color - Card's background color (hex color) or a gradient in the form of angle,start,end. Default: fffefe
  • hide_border - Hides the card's border (boolean). Default: false
  • theme - name of the theme, choose from all available themes. Default: default theme.
  • cache_seconds - set the cache header manually (min: 14400, max: 86400). Default: 14400 seconds (4 hours).
  • locale - set the language in the card (e.g. cn, de, es, etc.). Default: en.
  • border_radius - Corner rounding on the card. Default: 4.5.

Warning We use caching to decrease the load on our servers (see anuraghazra#1471 (comment)). Our cards have a default cache of 4 hours (14400 seconds). Also, note that the cache is clamped to a minimum of 4 hours and a maximum of 24 hours. This is why we recommend using our GitHub Action :)

Gradient in bg_color

You can provide multiple comma-separated values in the bg_color option to render a gradient with the following format:

&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10

Stats Card Exclusive Options

  • hide - Hides the specified items from stats (Comma-separated values). Default: [] (blank array).
  • hide_title - (boolean). Default: false.
  • card_width - Set the card's width manually (number). Default: 500px (approx.).
  • hide_rank - (boolean) hides the rank and automatically resizes the card width. Default: false.
  • show_icons - (boolean). Default: false.
  • include_all_commits - Count total commits instead of just the current year commits (boolean). Default: false.
  • count_private - Count private commits (boolean). Default: false.
  • line_height - Sets the line height between text (number). Default: 25.
  • exclude_repo - Exclude stars from specified repositories (Comma-separated values). Default: [] (blank array).
  • custom_title - Sets a custom title for the card. Default: <username> GitHub Stats.
  • text_bold - Use bold text (boolean). Default: true.
  • disable_animations - Disables all animations in the card (boolean). Default: false.
  • ring_color - Color of the rank circle (hex color). Defaults to the theme ring color if it exists and otherwise the title color.

Note When hide_rank=true, the minimum card width is 270 px + the title length and padding.

Repo Card Exclusive Options

  • show_owner - Show the repo's owner name (boolean). Default: false.

Language Card Exclusive Options

  • hide - Hide the languages specified from the card (Comma-separated values). Default: [] (blank array).
  • hide_title - (boolean). Default: false.
  • layout - Switch between two available layouts default & compact. Default: default.
  • card_width - Set the card's width manually (number). Default 300.
  • langs_count - Show more languages on the card, between 1-10 (number). Default 5.
  • exclude_repo - Exclude specified repositories (Comma-separated values). Default: [] (blank array).
  • custom_title - Sets a custom title for the card (string). Default Most Used Languages.
  • disable_animations - Disables all animations in the card (boolean). Default: false.
  • hide_progress - It uses the compact layout option, hides percentages, and removes the bars. Default: false.

Warning Language names should be URI-escaped, as specified in Percent Encoding (i.e: c++ should become c%2B%2B, jupyter notebook should become jupyter%20notebook, etc.) You can use urlencoder.org to help you do this automatically.

Wakatime Card Exclusive Options

  • hide - Hide the languages specified from the card (Comma-separated values). Default: [] (blank array).
  • hide_title - (boolean). Default false.
  • line_height - Sets the line height between text (number). Default 25.
  • hide_progress - Hides the progress bar and percentage (boolean). Default false.
  • custom_title - Sets a custom title for the card (string). Default Wakatime Stats.
  • layout - Switch between two available layouts default & compact. Default default.
  • langs_count - Limit the number of languages on the card, defaults to all reported languages (number).
  • api_domain - Set a custom API domain for the card, e.g. to use services like Hakatime or Wakapi (string). Default Waka API.
  • range – Request a range different from your WakaTime default, e.g. last_7_days. See WakaTime API docs for a list of available options. (YYYY-MM, last_7_days, last_30_days, last_6_months, last_year, or all_time). Default all_time.

GitHub Extra Pins

GitHub extra pins allow you to pin more than six repositories in your profile using a GitHub readme profile.

Yay! You are no longer limited to 6 pinned repositories.

Usage

Use the api/pin endpoint with the API or the card: 'repo' option with the GitHub Action.

Demo

Readme Card

Use show_owner variable to include the repo's owner username

Readme Card

Top Languages Card

The top languages card shows a GitHub user's most frequently used top language.

Note Top Languages does not indicate skill level or anything like that; it's a GitHub metric to determine which languages have the most code on GitHub.

Usage

Use the api/top-langs endpoint with the API or the card: 'top-langs' option with the GitHub Action.

Exclude individual repositories

You can use the &exclude_repo=repo1,repo2 parameter to exclude individual repositories.

?username=anuraghazra&exclude_repo=github-readme-stats,anuraghazra.github.io

Hide individual languages

You can use &hide=language1,language2 parameter to hide individual languages.

?username=anuraghazra&hide=javascript,html

Show more languages

You can use the &langs_count= option to increase or decrease the number of languages shown on the card. Valid values are integers between 1 and 10 (inclusive), and the default is 5.

?username=anuraghazra&langs_count=8

Compact Language Card Layout

You can use the &layout=compact option to change the card design.

?username=anuraghazra&layout=compact

Hide Progress Bars

You can use the &hide_progress=true option to hide the percentages and the progress bars (layout will be automatically set to compact).

?username=anuraghazra&hide_progress=true

Demo

Top Langs

  • Compact layout

Top Langs

  • Hidden progress bars

Top Langs

Wakatime Week Stats

Usage

Use the api/wkatime endpoint with the API or the card: 'wakatime' option with the GitHub Action.

Change the ?username= value to your Wakatime username.

?username=willianrod

Note: Please be aware that we currently only show data from Wakatime profiles that are public.

Compact Wakatime Card Layout

You can use the &layout=compact option to change the card design.

?username=willianrod&layout=compact

Demo

willianrod's wakatime stats

willianrod's wakatime stats

  • Compact layout

willianrod's wakatime stats


All Demos

  • Default

Anurag's GitHub stats

  • Hiding specific stats

Anurag's GitHub stats

  • Showing icons

Anurag's GitHub stats

  • Customize Border Color

Anurag's GitHub stats

  • Include All Commits

Anurag's GitHub stats

  • Themes

Choose from any of the default themes

Anurag's GitHub stats

  • Gradient

Anurag's GitHub stats

  • Customizing stats card

Anurag's GitHub stats

  • Setting card locale

Anurag's GitHub stats

  • Customizing repo card

Customized Card

  • Top languages

Top Langs

  • WakaTime card

willianrod's wakatime stats


Quick Tip (Align The Repo Cards)

By default, GitHub does not lay out the cards side by side. To do that, you can use this approach:

<a href="https://github.com/anuraghazra/github-readme-stats">
  <img align="center" src="https://SVG_URL/" />
</a>
<a href="https://github.com/anuraghazra/convoychat">
  <img align="center" src="https://SVG_URL/" />
</a>

Deploy your own Vercel instance

Warning If you are on the hobby (i.e. free) Vercel plan, please make sure you change the maxDuration parameter in the vercel.json file from 30 to 10 (see #1416 for more information).

Since the GitHub API only allows 5k requests per hour, my https://github-readme-stats.vercel.app/api could possibly hit the rate limiter. If you host it on your own Vercel server, then you do not have to worry about anything. Click on the deploy button to get started!

Note Since #58, we should be able to handle more than 5k requests and have fewer issues with downtime 😁.

Deploy to Vercel

🛠️ Step-by-step guide on setting up your own Vercel instance
  1. Go to vercel.com.
  2. Click on Log in.
  3. Sign in with GitHub by pressing Continue with GitHub.
  4. Sign in to GitHub and allow access to all repositories if prompted.
  5. Fork this repo.
  6. After forking the repo, open the vercel.json file and change the maxDuration field to 10.
  7. Go back to your Vercel dashboard.
  8. To import a project, click the Add New... button and select the Project option.
  9. Click the Continue with GitHub button, search for the required Git Repository and import it by clicking the Import button. Alternatively, you can import a Third-Party Git Repository using the Import Third-Party Git Repository -> link at the bottom of the page.
  10. Create a personal access token (PAT) here and enable the repo permissions (this allows access to see private repo stats).
  11. Add the PAT as an environment variable named PAT_1 (as shown).
  12. Click deploy, and you're good to go. See your domains to use the API!

Keep your fork up to date

You can keep your fork, and thus your private Vercel instance up to date with the upstream using GitHub's Sync Fork button. You can also use the pull package created by @wei to automate this process.

💖 Support the project

I open-source almost everything I can and try to reply to everyone needing help using these projects. Obviously, this takes time. You can use this service for free.

However, if you are using this project and are happy with it or just want to encourage me to continue creating stuff, there are a few ways you can do it:

  • Giving proper credit when you use github-readme-stats on your readme, linking back to it :D
  • Starring and sharing the project 🚀
  • paypal.me/anuraghazra - You can make one-time donations via PayPal. I'll probably buy a coffee tea. 🍵

Thanks! ❤️


https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss

Contributions are welcome! <3

Made with ❤️ and JavaScript.

About

⚡ Dynamically generated stats for your github readmes

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 99.8%
  • Shell 0.2%