News for hackers. Stuff that matters.
Re:Syntax Highlighting Is Backwards (2018) by uxp on Friday November 29, 2019 @11:47AM (#21665339)
Do I have some weird rendering issue with this website, or do both of these snippets of code have terrible readability and highlighting? If I had to write code using an IDE or editor with this scheme I'd quit my career and go into small engine repair.

https://imgur.com/a/vS2EldV

Re:Syntax Highlighting Is Backwards (2018) by pcr910303 on Friday November 29, 2019 @11:53AM (#21665388)
I'm pretty sure it's b.c. you have dark mode turned on & the CSS didn't consider code snippets.

Try turning them off, it'll look much better.

Re:Syntax Highlighting Is Backwards (2018) by jeltz on Friday November 29, 2019 @11:55AM (#21665405)
Thanks, it is better now but still not very good.
Re:Syntax Highlighting Is Backwards (2018) by Mathnerd314 on Friday November 29, 2019 @12:11PM (#21665507)
ui.systemUsesDarkTheme = 0 for FF users.
Re:Syntax Highlighting Is Backwards (2018) by mercora on Friday November 29, 2019 @02:15PM (#21666192)
I use "widget.content.gtk-theme-override;Adwaita:light" to fix commonly invalid assumptions about default colors and appearances.

It overrides the GTK theme used to render page content and still allows to use a dark theme (or whatever you want) for UI components.

Re:Syntax Highlighting Is Backwards (2018) by SahAssar on Friday November 29, 2019 @11:52AM (#21665382)
I think this is what it is supposed to look like: https://imgur.com/a/OHkBb8Q
Re:Syntax Highlighting Is Backwards (2018) by jeltz on Friday November 29, 2019 @11:51AM (#21665369)
Nope, it looks the same to me and I have a screen with high contrast and high brightness. Both his examples are very hard to read. And I have done color blindness tests and know I am not color blind.

Another thing: I think one thing he is missing is how important it is to see at a glance where function definitions are and where possible early returns are. The first example highlights def (function definitions), return (possible early return) and the return type (arguably not that important in most cases).

Re:Syntax Highlighting Is Backwards (2018) by benkuhn on Friday November 29, 2019 @12:31PM (#21665649)
Sorry about that! I built dark mode after writing this post and it broke the main text color inside the `pre`s, which should have been #222. Should be fixed now.
Re:Syntax Highlighting Is Backwards (2018) by czr on Friday November 29, 2019 @12:12PM (#21665514)
hack to switch to light mode, if you don't want to do it systemwide (paste into console):

    Array.from(document.styleSheets).forEach(ss => Array.from(ss.rules).forEach((ssr,i) => {if (ssr.cssText && ssr.cssText.includes("dark")) {ssr.parentStyleSheet.deleteRule(i)}}))
Re:Syntax Highlighting Is Backwards (2018) by FPGAhacker on Friday November 29, 2019 @11:49AM (#21665356)
That’s what it looked like for me. I thought maybe it looked illegible to me due to red-green color deficiency.
Re:Syntax Highlighting Is Backwards (2018) by FPGAhacker on Friday November 29, 2019 @11:51AM (#21665374)
It’s a dark mode thing. Looks normalish with dark mode off.
Re:Syntax Highlighting Is Backwards (2018) by jeltz on Friday November 29, 2019 @11:52AM (#21665377)
Nope, I am not color blind and it is very hard to read for me too.
Re:Syntax Highlighting Is Backwards (2018) by saagarjha on Friday November 29, 2019 @11:49AM (#21665348)
The text is black for me on my iPhone.
Re:Syntax Highlighting Is Backwards (2018) by FPGAhacker on Friday November 29, 2019 @11:50AM (#21665362)
It might be a dark mode thing.

Edit: Yep, dark mode mangled the code snippets.

Re:Syntax Highlighting Is Backwards (2018) by saagarjha on Friday November 29, 2019 @11:51AM (#21665371)
It is!