Skip to content

Dynamically generated Code::Stats stats for your profile readme.

License

Notifications You must be signed in to change notification settings

WEGFan/codestats-profile-readme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code::Stats Profile Readme

Get dynamically generated Code::Stats stats on your profile readme!

View Demo · Report Bug · Request Feature


Note that Github's server aborts the request if it reaches the 4-second timeout. So maybe the images won't show because my server is waiting for response from Code::Stats, try refreshing and see if it shows.
To prevent heavy load from Code::Stats server, all data from same user will be cached for 30 minutes before updating data.

Features

Code::Stats History Graph

Simply add this to your markdown and change username to your Code::Stats username.

![My Code::Stats history graph](https://codestats-readme.wegfan.cn/history-graph/username)

Increasing history days

You can increase history days up to 30 days by adding a query parameter ?history_days=

![My Code::Stats history graph](https://codestats-readme.wegfan.cn/history-graph/username?history_days=30)

Increasing maximum languages

You can increase maximum languages up to 15 by adding a query parameter ?max_languages=

![My Code::Stats history graph](https://codestats-readme.wegfan.cn/history-graph/username?max_languages=15)

Customizing colors

You can customize the colors of grid, text, zeroline and bars by adding grid_color, text_color, zeroline_color and language_colors query parameters.

The language_colors is a list of colors seperated by comma and wrapped with [], each color should be wrapped with quotes (e.g. ["red","hsl(0,100%,50%)","rgba(255,0,0,0.5)"])

![My Code::Stats history graph](https://codestats-readme.wegfan.cn/history-graph/username?grid_color=e8e8e8&text_color=666666&zeroline_color=ababab&language_colors=["red","green","blue"])

See color string below for supported color representations.

More customization

query parameter type description default value
history_days integer how many days to show in the graph, maximum 30 14
max_languages integer how many languages to show before grouping into "Others", maximum 15 8
timezone timezone string what timezone to use to calculate day ranges 00:00
width integer the width of image (in pixels) 900
height integer the height of image (in pixels) 450
show_legend boolean whether to show graph legend on the right true
bg_color color string the color of the image's background ffffff
grid_color color string the color of the grid e8e8e8
text_color color string the color of the text 666666
zeroline_color color string the color of the zero-line ababab
language_colors color string list the colors of each langauge and "Others" (loops if length is less than max_languages) ["3e4053","f15854","5da5da", "faa43a","60bd68","f17cb0", "b2912f","decf3f","b276b2"]

Special types:

Color string

  • A hex string without # (e.g. ff0000, ADE for aaddee)
  • An rgb/rgba string (e.g. rgb(255,0,0), rgba(0,128,128,0.5))
  • An hsl/hsla string (e.g. hsl(0,100%,50%), hsla(60,50%,50%,0.7))
  • An hsv/hsva string (e.g. hsv(0,100%,100%), hsva(120,100%,100%,0.5))
  • A named CSS color, full list here

Timezone string

  • A string describing a timezone (e.g. US/Pacific, Europe/Berlin)
  • A string in ISO 8601 style (e.g. 07:30, -05:00, 0630, -08)

Demo

  • Default

WEGFan's Code::Stats history graph

  • Smaller with fewer history days & languages

WEGFan's Code::Stats history graph

  • Customizing colors

WEGFan's Code::Stats history graph


Deploy on your own server

You can also deploy this project on your own server by following the instructions below.

Prerequisites:

  • Python 3.6 64-bit or later. (64-bit is required because kaleido is currently not providing 32-bit pre-compiled wheels)
  • (Optional) Redis for caching. If not installed, the app will use a file system cache instead, which is not very performant thus it is highly recommended that you configure a Redis server.
  • (Optional) SVGO for optimizing SVGs (also requires Node.js)
  1. Clone the project: git clone https://github.com/WEGFan/codestats-profile-readme && cd codestats-profile-readme
  2. Install requirements: pip install -r requirements.txt
  3. Edit your config in config/custom_config.py.
  4. Run: gunicorn -c gunicorn_config.py run:app, and you should be able to access it by http://127.0.0.1:2012 on your server

About

Dynamically generated Code::Stats stats for your profile readme.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published