Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new Github style? #1

Open
fladd opened this issue Apr 6, 2020 · 4 comments
Open

Update to new Github style? #1

fladd opened this issue Apr 6, 2020 · 4 comments

Comments

@fladd
Copy link

fladd commented Apr 6, 2020

Hi there,

great Pygments style! I was wondering whether you have plans to update it reflect the current Github style?

image

@PhilipTrauner
Copy link
Owner

I was pretty surprised to hear that they've reworked the token style, as I've never noticed any changes. After comparing Markdown and how its rendered by different GitHub features I now know why: They don't seem to apply the new style everywhere.

Here's a quick comparison:

Unmodified pygmentsUnmodified pygments
Modified pygmentsModified pygments
GitHub Markdown PreviewGitHub Markdown Preview
GitHub GistGitHub Gist

Unmodified pygments still closely (within the constraints pointed out in the README.md) matches GitHub Markdown Preview.

GitHub Gist is definitely different though, so I've tried to replicate it by making the following changes which are illustrated by Modified pygments.

diff --git a/dist/style/github.css b/dist/style/github.css
index 3af9410..359bd0f 100644
--- a/dist/style/github.css
+++ b/dist/style/github.css
@@ -1,5 +1,5 @@
 .highlight .hll { background-color: #ffffcc }
-.highlight  { background: #f8f8f8; }
+.highlight  { background: #f6f8fa; }
 .highlight .c { color: #6a737d } /* Comment */
 .highlight .err {  } /* Error */
 .highlight .k { color: #d73a49 } /* Keyword */
@@ -29,12 +29,12 @@
 .highlight .m { color: #666666 } /* Literal.Number */
 .highlight .s { color: #032f62 } /* Literal.String */
 .highlight .na { } /* Name.Attribute */
-.highlight .nb { color: #005cc5 } /* Name.Builtin */
-.highlight .nc { color: #6f42c1 } /* Name.Class */
+.highlight .nb { color: #6f42c1 } /* Name.Builtin */
+.highlight .nc { color: #e36209 } /* Name.Class */
 .highlight .no { color: #005cc5 } /* Name.Constant */
 .highlight .nd { color: #6f42c1 } /* Name.Decorator */
 .highlight .ni { color: #005cc5 } /* Name.Entity */
-.highlight .ne { color: #005cc5 } /* Name.Exception */
+.highlight .ne { color: #e36209 } /* Name.Exception */
 .highlight .nf { color: #6f42c1 } /* Name.Function */
 .highlight .nl { color: #005cc5 } /* Name.Label */
 .highlight .nn { color: #6f42c1 } /* Name.Namespace */

I'm not opposed to pushing these to master, so please me know if you are satisfied with the result 🙂

@fladd
Copy link
Author

fladd commented Apr 7, 2020

Looks good.

Some more observations:

  1. Shouldn't things like "is" and "not" in Python be blue, rather than orange.

  2. I also spotted some other differences in other languages (HTML, Ruby, C++). Not sure if they were related to changes at GitHub or due to limitations of Pygments.

    Have a look at those examples here: https://gist.github.com/fladd/3280e197f0b9d6958c25b121e7ac3390

  3. You could also consider switching on operators. Since they are blue now, the additional colouring of dots by Pygments is barely seen and not too distracting.

@fladd
Copy link
Author

fladd commented Feb 25, 2021

Any news on this?

@PhilipTrauner
Copy link
Owner

PhilipTrauner commented Feb 26, 2021

Don't have time to perform these changes right now, but would still be open to merging this in if you put together a PR. (please update the "Compromises" table as well) 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants