/github-readme-streak-stats

🔥 Stay motivated and show off your contribution streak! 🌟 Display your total contributions, current streak, and longest streak on your GitHub profile README

Primary LanguagePHPMIT LicenseMIT

Github Readme Streak Stats

Display your total contributions, current streak,
and longest streak on your GitHub profile README

⚡ Quick setup

  1. Copy-paste the markdown below into your GitHub profile README
  2. Replace the value after ?user= with your GitHub username
[![GitHub Streak](https://streak-stats.demolab.com/?user=DenverCoder1)](https://git.io/streak-stats)
  1. Star the repo 😄

Note See below for customization options and about deploying the app on your own.

⚙ Demo Site

Here you can customize your Streak Stats card with a live preview.

http://streak-stats.demolab.com/demo/

Demo Site

🔧 Options

The user field is the only required option. All other fields are optional.

If the theme parameter is specified, any color customizations specified will be applied on top of the theme, overriding the theme's values.

Parameter Details Example
user GitHub username to show stats for DenverCoder1
theme The theme to apply (Default: default) dark, radical, etc. 🎨➜
hide_border Make the border transparent (Default: false) true or false
border_radius Set the roundness of the edges (Default: 4.5) Number 0 (sharp corners) to 248 (ellipse)
background Background color hex code without # or css color
border Border color hex code without # or css color
stroke Stroke line color between sections hex code without # or css color
ring Color of the ring around the current streak hex code without # or css color
fire Color of the fire in the ring hex code without # or css color
currStreakNum Current streak number hex code without # or css color
sideNums Total and longest streak numbers hex code without # or css color
currStreakLabel Current streak label hex code without # or css color
sideLabels Total and longest streak labels hex code without # or css color
dates Date range text color hex code without # or css color
date_format Date format pattern or empty for locale format See note below on 📅 Date Formats
locale Locale for labels and numbers (Default: en) ISO 639-1 code - See 🗪 Locales
type Output format (Default: svg) Current options: svg, png or json
mode Streak mode (Default: daily) daily (contribute daily) or weekly (contribute once per Sun-Sat week)

🖌 Themes

To enable a theme, append &theme= followed by the theme name to the end of the source URL:

[![GitHub Streak](https://streak-stats.demolab.com/?user=DenverCoder1&theme=dark)](https://git.io/streak-stats)
Theme Preview
default default
dark dark
highcontrast highcontrast
More themes! 🎨 See a list of all available themes

If you have come up with a new theme you'd like to share with others, please see Issue #32 for more information on how to contribute.

🗪 Locales

The following are the locales that have labels translated in Streak Stats. The locale query parameter accepts any ISO language or locale code, see here for a list of valid locales. The locale provided will be used for the date format and number format even if translations are not yet available.

en - English
English 100%
ar - العربية
العربية 100%
bg - български
български 100%
bn - বাংলা
বাংলা 100%
de - Deutsch
Deutsch 100%
es - español
español 100%
fa - فارسی
فارسی 100%
fr - français
français 100%
he - עברית
עברית 100%
hi - हिन्दी
हिन्दी 100%
id - Indonesia
Indonesia 100%
it - italiano
italiano 100%
ja - 日本語
日本語 100%
kn - ಕನ್ನಡ
ಕನ್ನಡ 100%
ko - 한국어
한국어 100%
mr - मराठी
मराठी 100%
nl - Nederlands
Nederlands 100%
pl - polski
polski 100%
ps - پښتو
پښتو 100%
pt_BR - português (Brasil)
português (Brasil) 100%
ru - русский
русский 100%
uk - українська
українська 100%
ur_PK - اردو (پاکستان)
اردو (پاکستان) 100%
vi - Tiếng Việt
Tiếng Việt 100%
yo - Èdè Yorùbá
Èdè Yorùbá 100%
zh_Hans - 中文(简体)
中文(简体) 100%
zh_Hant - 中文(繁體)
中文(繁體) 100%
da - dansk
dansk 67%
ta - தமிழ்
தமிழ் 67%
tr - Türkçe
Türkçe 67%

If you would like to help translate the Streak Stats cards, please see Issue #236 for more information.

📅 Date Formats

If date_format is not provided or is empty, the PHP Intl library is used to determine the date format based on the locale specified in the locale query parameter.

A custom date format can be specified by passing a string to the date_format parameter.

The required format is to use format string characters from PHP's date function with brackets around the part representing the year.

When the contribution year is equal to the current year, the characters in brackets will be omitted.

Examples:

Date Format Result
d F[, Y]
"2020-04-14" => "14 April, 2020"

"2022-04-14" => "14 April"
j/n/Y
"2020-04-14" => "14/4/2020"

"2022-04-14" => "14/4/2022"
[Y.]n.j
"2020-04-14" => "2020.4.14"

"2022-04-14" => "4.14"
M j[, Y]
"2020-04-14" => "Apr 14, 2020"

"2022-04-14" => "Apr 14"

Example

[![GitHub Streak](https://streak-stats.demolab.com/?user=denvercoder1&currStreakNum=2FD3EB&fire=pink&sideLabels=F00&date_format=[Y.]n.j)](https://git.io/streak-stats)

ℹ️ How these stats are calculated

This tool uses the contribution graphs on your GitHub profile to calculate which days you have contributed.

To include contributions in private repositories, turn on the setting for "Private contributions" from the dropdown menu above the contribution graph on your profile page.

Contributions include commits, pull requests, and issues that you create in standalone repositories.

The longest streak is the highest number of consecutive days on which you have made at least one contribution.

The current streak is the number of consecutive days ending with the current day on which you have made at least one contribution. If you have made a contribution today, it will be counted towards the current streak, however, if you have not made a contribution today, the streak will only count days before today so that your streak will not be zero.

Note You may need to wait up to 24 hours for new contributions to show up (Learn how contributions are counted)

📤 Deploying it on your own

If you can, it is preferable to host the files on your own server.

Doing this can lead to better uptime and more control over customization (you can modify the code for your usage).

You can deploy the PHP files on any website server with PHP installed or as a Heroku app.

The Inkscape dependency is required for PNG rendering, as well as Segoe UI font for the intended rendering. If using Heroku, the buildpacks will install these for you automatically.

Deploy Streak Stats instantly

Heroku_logo

Heroku costs around $5-$7/month minimum for a single app, but you can contact the Open Source program at ospo-heroku-credits@salesforce.com to possibly get free credits.

Instructions for Deploying to Heroku

Step-by-step instructions for deploying to Heroku

  1. Sign in to Heroku or create a new account at https://heroku.com
  2. Visit this link to create a new Personal Access Token (no scopes required)
  3. Scroll to the bottom and click "Generate token"
  4. Click the Deploy button below

Deploy to Heroku

  1. Add the token as a Config Var with the key TOKEN:

heroku config variables

  1. Click "Deploy App" at the end of the form
  2. Once the app is deployed, you can use <your-app-name>.herokuapp.com in place of streak-stats.demolab.com

Vercel_logo

Vercel is a free hosting service that can be used to run PHP. Note: The intl library seems to not be available through Vercel at the moment (vercel-community/php#367), so the automatic number and date formats for locales other than English will not work. PNG mode is also not supported since Inkscape will not be installed.

Instructions for Deploying to Vercel for Free

Step-by-step instructions for deploying to Vercel

  1. Sign in to Vercel or create a new account at https://vercel.com
  2. Clone this repository with git clone https://github.com/DenverCoder1/github-readme-streak-stats.git
    • You may also fork the repository and clone your fork instead if you intend to make changes
  3. Enter the directory with cd github-readme-streak-stats
  4. Switch branches to the vercel branch with git checkout vercel
  5. Make sure you have the Vercel CLI installed
  6. Run vercel and follow the prompts to link your Vercel account and select a project name
  7. The app will be deployed to <project-name>.vercel.app
  8. Visit this link to create a new Personal Access Token (no scopes required)
  9. Scroll to the bottom and click "Generate token"
  10. Visit the Vercel dashboard and select your project, then click "Settings", then "Environment Variables".
  11. Add a new variable with the key TOKEN and the value as your token from step 9 and click "Save".
  12. For the environment variable to be available, you will need to redeploy the app. Run vercel --prod to deploy to production.

image

Note
To set up automatic Vercel deployments from GitHub, make sure to turn off "Include source files outside of the Root Directory" in the General settings and use vercel as the production branch in the Git settings.

🤗 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you have a way to improve this project.

Make sure your request is meaningful and you have tested the app locally before submitting a pull request.

Refer to CONTRIBUTING.md for more details on contributing, installing requirements, and running the application.

🙋‍♂️ Support

💙 If you like this project, give it a ⭐ and share it with friends!

Youtube Sponsor with Github

☕ Buy me a coffee


Made with ❤️ and PHP

Powered by Heroku