I hadn’t visited the docs since Add Syntax Highlighting to Code Reference
but today I see that the syntax highlighting doesn’t match the page.
The code is showing as black background and green text on a white page. It looks awful and is hard to read. It should be dark mode only if the user chooses dark mode in their system.
Meta: I couldn’t create this topic without a tag, but I don’t know what tag it should have… This is obnoxious.
I think it should match the page it’s on. The default and the Coy theme both look fine.
If you ever implement a dark mode for the CP site, you could figure out how to use a dark theme.
I’m on Ubuntu Studio 20.04 using Firefox 90.0. It looks the same in an incognito window with Stylus disabled also (I had no styles for that domain anyway).
I went back to the Prism site and tried the dark themes. Each looked legible with a selection, so I don’t understand what is changing it on the CP page.
Kidding. I will check if I can solve this with the “blank” theme although I do not like that, code editors are dark, so code should be on dark background too. @anon71687268 when you test this same thing on Download ▲ Prism is it happening as well?
(scroll down for a sample of code)
Aaaargh.
Just replicated it with my FF too. And not happening on their own site, but also, their preview looks nothing like what we get at the end anyway.
Opened an issue with them on Github before I go and replace the theme.
This does not look right to me.
No, they are not dark by default. You have to choose it.
I find it easier to read black or colors on white than on black, so I never choose it.
I say take the default styles of the highlighter and use that, so it matches the page. Then if the user has a dark mode or the docs theme implements a dark mode later, it will all be consistent.
(I didn’t look, but perhaps the docs theme has a style for :selected)
It’s true, light themes are better for performance for people with normal vision but long-term exposure may lead to nearsightedness. It’s always best to offer user a choice between the two.
On the other hand, whatever the theme is all the colors used for colorization need to be reviewed for contrast ratio against the background to meet WCAG 2.1/2.2 standard. This includes selection background color and text color.
In all honesty thou, working since a few years with programmers all over the world I literally never found a light mode code editor active
They all have a dark mode! This is the main reason I even chose dark mode on the site, I thought it’s sort of a “preference” as well amongst programmers (apart of foolishly forgetting that those apps all have preference settings)
Ok so
a) prism does not apply Firefox specific selection rules. I can fix that with CSS
b) each browser handles the color differently. While I can fix only FF and leave safari as there it looks good, this fix screws up chrome, which by default also looks good, but with the FF fix breaks.
We’d need modernizr I think to detect specific browser, and apply a fix for each. Not a reasonable work given the issue
Thus I downloaded and deployed the “default” mode which does not have this issue at all (tested on Safari, Chrome and FF on Mac)
Looks awful if you ask me but if it makes people happy, I am happy too
If you want other styles I suggest building a package on Download ▲ Prism and send me the link of the build, so I can deploy that.