DEV Community

loading...
Cover image for How To Change Your Github Contribution Graph Colour To Something Cool

How To Change Your Github Contribution Graph Colour To Something Cool

abdurrahmaanj profile image Abdur-Rahmaan Janhangeer ・3 min read

In this post we'll be seeing how to change your contribution on github to a nice colour scheme. It's an easy tutorial, detailed enough, feel free to clear up any doubt! Let us begin.

Reconaissance

First this is what we mean by contribution graph. The green squares.

github contribution graph

Now we need to see how github actually does it. Right click then choose inspect element.

Alt text of image

Next we see a box has appeared. That shows us how the page is structured, as well as showing console messages. This is good for debugging.

Alt text of image

Now if you want to change it's position, click on the dots, then select your preferred view.

Alt text of image

Now we'll uncover the secret behind individual squares by using the selection tool.

Alt text of image

Then we'll be looking at an individual square

Alt text of image

Aha, so, we have an element with class day and the colour is in the fill attribute. Nice!

Alt text of image

In Enters The Tampering Monkey

Tampermonkey is a tool that allows you to change/tamper with the codes found in your webpage. On opera it is available

Alt text of image

as well as on chrome

Alt text of image

If all went well, you should see a nice icon on the top right of the browser (I'm using opera)

Alt text of image

Now let us create a new script

Alt text of image

we get this screen
Alt text of image

now let us match all domains on github

Alt text of image

and change the script name

Alt text of image

now if we press save, we'll be directed to this screen. just click on the name to return on your editor

Alt text of image

upon inspection of our github page, we find two things

  • there are 5 levels of colours

Alt text of image

and

  • they are graded according to data-count

Alt text of image

so here is our starting point

Alt text of image

now let us add grading of count

Alt text of image

save

Seeing The Result

now go to github and press on the logo, you'll see our script active

Alt text of image

now refresh the page and you'll see something like that:

Alt text of image

just now we need to deal with the legend

Dealing With The Legend

inspecting the legend reveals a class legend with li children and background colour

Alt text of image

we change our codes accordingly

Alt text of image

and tada!

Alt text of image

now whenever we move around, our graphs are coloured the same. Ethan Furman's profile for example

Alt text of image

Wrapping Up

You can find the source here (a gist would have been more appropriate)

also view it on greasyfork here

Feel free to propose more colour schemes below. Hope you enjoyed the article!

Discussion (5)

Collapse
terabytetiger profile image
Tyler V. (he/him)

Wow! This is a really good and in depth tutorial, great job!

On top of being very detailed, it also does a great job of walking through the "Dev process" of going from "Okay, how does this work?" to "Cool, so I see how it works... what can I do to 'improve' it" to "Look at this cool thing I did" which is the very process that made me fall in love with webdev.

Collapse
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer Author • Edited

Thank You! Yes, missing the in-betweens make beginners remain beginners. XD my main stuff is python, i think i wrote a Js tutorial after a really long time! The web is unbypassable, so is web dev _. "Dev process" , i liked that one!

edit: i see you tried flask, how did you find it?

Collapse
terabytetiger profile image
Tyler V. (he/him)

I haven't gotten very far into Flask yet, I have a tutorial that I'm trying to work through, but finding time to fit it in has been a bit rough lately. I would like to get into it more, just need to make time to really dive in!

Thread Thread
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer Author

pythonmembers.club/2018/07/01/web-...

an article i once wrote. to add libs, like animate.css just add it in static folder and in your html file add the path as "static/animate.css", no need for special flask { } things.

for api see marshmallow, very easy, don't use flask-restful. The best tuto in my opinion is building something, that actually reduces the amount of time learning. A CRUD app with login should cover what you need to know, just be sure to use those things called blueprints. Use SQLite to start with flask-sqlalchemy so that switching db only means switching settings. better, you could a localhost app for someone, mimicking pushing to production at the same time.

else, i'm building something flask right now, will push to github soon and notify you. any flask question, i'll try my best to help you!

Thread Thread
terabytetiger profile image
Tyler V. (he/him)

Thanks! Seems like a good place to start! I'll let you know if I have any questions! :D

Forem Open with the Forem app