DennisSnijder / MakeGithubGreatAgain

Extension for making GitHub great again
https://chrome.google.com/webstore/detail/makegithubgreatagain/gpejlkhibgecggplgogpbgbdpnhogmhk
1.05k stars 50 forks source link

Make Github colors great again! #51

Closed joeytwiddle closed 7 years ago

joeytwiddle commented 7 years ago

I have combined @tombola's link styling and toggling code with @svnpenn's restored colors, and then I applied a few fixes on top, for #49.

It's not as clean as I would like, and no doubt there will be more edge cases to fix in the coming weeks, months and years, but this is getting me by for today at least.

Some wild thoughts appeared:

Adding the .great-again class allows us to easily toggle the changes on/off, but it also makes our CSS rules more specific, and as a result they sometimes override more than they should do! So I have had to add many exceptions to the rule that makes links blue. But it is difficult to make an exception with :not() if the link does not have a class directly on it, so in some cases I had to specifically restore the color of the unintentionally styled link. Argh!

One alternative to this approach would be to instead add a very plain a { ... } rule after the site's CSS has loaded. That would have the advantage of overriding fewer things accidentally. But it would also have disadvantages: We might see the original colors for a moment, before our CSS is applied. And without .great-again toggling would now be harder (we might have to edit our CSS in the DOM).

A radically alternative approach to re-styling would be to go through the CSSDOM and change all occurrences of #0366d6 (the new link color) into #4078c0 (the old link color). This would magically keep up with any new CSS rules added in the future, but on the other hand it would fail if the color theme is ever changed again.

If we do stick with the .great-again class, then we can probably remove most of the !importants from svnpenn's save-the-colors.css. I just didn't get around to testing that.

I have tried to comment each CSS rule with the things that it changes, so we can check in future whether that particular requirement is still met. Please ignore the comments if you find them too verbose.

Eventually I would love to get these colors into a userscript, so I can enjoy them in all the browsers

Didn't issues used to have the thumbnails of the participants next to them in the issues list? Has this feature disappeared, or was it only ever in enterprise?

joeytwiddle commented 7 years ago

Update: I added a couple more fixes today, including more traditional colors for the header (darker text and icon, corrected blues and white on the search box).

For a truly classic header, add the class short-header next to great-header. I provided CSS rules for this but did not add the class to the page, thinking people might actually like the new height. If we get around to adding an options feature, then this could be one of the options.

joeytwiddle commented 7 years ago

Update: I have moved from a broad selector with a blacklist, to a whitelist. This is less problematic, because it doesn't select so many things by accident.

I also changed the topic tags from blue-on-blue to grey-on-grey because I feel they fit better with the classic colors when they are toned down.

DennisSnijder commented 7 years ago

Awesome work! Let me know once this is ready for merge!

joeytwiddle commented 7 years ago

Well it's pretty stable now if you want to merge it. There may be a few elements in the less-visited corners of the site that will need small tweaks in the future.

(Adding an options page has removed the following concerns.)

I am a bit concerned: How many users of this extension actually want the old colours back, and how many just want the white header? I guess merging would be one dramatic way to find out...!

But if we want to make everyone happy, I think an options page will be needed. (Ideally on right-click, so we can keep the toggle on left-click.) Not sure if I'll ever get around to that though.

joeytwiddle commented 7 years ago

I have added an options page, so a few things can be toggled on/off. This required a bit of refactoring.

joeytwiddle commented 7 years ago

Let's merge this. People have been suffering too long! I've even added CSS for gist.github.com.

With the options users can choose whether they want just the colors, or just the header, or both. By default, everything is great again.

DennisSnijder commented 7 years ago

Great effort man! Merging!