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

Fix Solarized line number colors #1477

Merged
merged 9 commits into from
Jul 4, 2020

Conversation

pfertyk
Copy link
Contributor

@pfertyk pfertyk commented Jun 7, 2020

Fixes #1356.

Changes:

  • the structure of line number elements and styles was changed to improve styling
  • all style definitions were moved to get_style_defs (and removed from CSSFILE_TEMPLATE)
  • documentation for noclasses option was updated
  • Style class received new attributes for:
    • line numbers font color
    • line numbers background color
    • special line numbers font color
    • special line numbers background color
  • line number font and background colors were defined for Solarized styles
  • tests were added to check the HTML output for different combinations of line number related options

@pfertyk pfertyk changed the title WIP Fix Solarized line number colors Fix Solarized line number colors Jun 20, 2020
Copy link
Collaborator

@Anteru Anteru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only one very minor comment -- otherwise this is really great work, and I do appreciate the time you put into testing this properly.

tests/test_cmdline.py Show resolved Hide resolved
@pfertyk
Copy link
Contributor Author

pfertyk commented Jun 26, 2020

@Anteru are there any other fixes you would like me to include?

@Anteru
Copy link
Collaborator

Anteru commented Jun 26, 2020

Nope, looks good, I'll merge as soon as I have some more time :)

@Anteru Anteru self-assigned this Jun 26, 2020
@Anteru Anteru added this to the 2.7 milestone Jun 26, 2020
@Anteru Anteru merged commit 728fd19 into pygments:master Jul 4, 2020
@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Jul 4, 2020
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Sep 3, 2020

@property
def _pre_style(self):
return 'line-height: 125%; margin: 0;'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - in which way margin: 0 makes it look better? In my case, it looks less pretty because there is no margin after the code. This looks more obvious when you write some explanation on the top and code after that few times, for example:

Oct-27-2020 18-30-12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another example:

With margin: 0

Screen Shot 2020-10-27 at 6 43 35 PM

Without margin: 0

Screen Shot 2020-10-27 at 6 44 02 PM

I trying to override the CSS now and I was curious why this change was made.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're seeing (I guess) because your theme doesn't have margin/padding on the paragraph either. I'd try to override the style if you care about specific padding/margin. That said, the margin: 0 was not intentional (I think) so I'll revert that for 2.7.3.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 4dede40

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Anteru :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! I'm sorry if I'm a bit too late, but I'm pretty I've introduced the margin: 0 rule for a reason. Since I've worked on this one some time ago, I'm not sure what exactly was it, but I'd guess it had something to do with making the table and non-table styles look more similar. An alternative might be that it had something to do with highlighting lines/special lines. There was a lot of different combinations of styles and highlight rules etc. and I believe margin: 0 was introduced to make everything work better in regard to some of these combinations.

Having said that, if it actually looks better without margin: 0 and it doesn't break anything else, I'm totally OK with removing this rule :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find the case where it would matter, and it does break various themes -- if you can point me to a problematic case then we can revisit alternative solutions. Ideally theme authors should have a way to override Pygments CSS rules, but for now this seems to be causing too much fallout :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to add all problematic cases to the test suite :P But while working on this a lot of dependencies came up and it's possible I've changed one thing too many ;) If you could just add a proper test with an explanation/justification, I would be very grateful. Right now, unfortunately, I'm not able to spend any time fixing this or checking why exactly was this change made. Reverting it seems like a good solution, as long as it's documented ;)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I ran a bunch of manual tests and also spot-checked the test cases, and couldn't find a problematic case. Was hoping you'd remember something particularly problematic, but given the feedback we got, it seems that any rule changing the margin will cause more harm than good :(

@HyukjinKwon
Copy link

@Anteru, please allow me a quick question here: when is expected release date of 2.7.3?

@Anteru
Copy link
Collaborator

Anteru commented Dec 6, 2020

Today.

@HyukjinKwon
Copy link

Thanks!

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

Successfully merging this pull request may close these issues.

Solarized line number wrong colors
3 participants