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.
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)
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)
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)
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.
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
foraaddee
) - 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
)
- Default
- Smaller with fewer history days & languages
- Customizing colors
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)
- Clone the project:
git clone https://github.com/WEGFan/codestats-profile-readme && cd codestats-profile-readme
- Install requirements:
pip install -r requirements.txt
- Edit your config in config/custom_config.py.
- Run:
gunicorn -c gunicorn_config.py run:app
, and you should be able to access it byhttp://127.0.0.1:2012
on your server