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
add a "colors off" button to code sections #2100
Conversation
for people who can't stand syntax highlighting for any reason. It will remember the choice in sessionStorage, just like debug mode, and will remove colors on page load if the setting was turned on. Restoring colors is also possible by just clicking the button again.
Also, the button could be styled to fit in better, both in terms of looks and positioning. |
FWIW, we have jQuery on the site, so stuff like const buttonDiv = document.createElement("DIV");
const button = document.createElement("BUTTON");
const text = document.createTextNode("colors " + colorsAre);
buttonDiv.style.float = "right";
button.appendChild(text);
buttonDiv.appendChild(button);
editor.insertAdjacentElement("afterBegin", buttonDiv); Can be written simply as $(editor).prepend(
$('<div><button>colors ' + colorsAre + '</button></div>')
.css({'float': 'right'})
); Or even sans-div: $(editor).prepend( $('<button/>').text('colors ' + colorsAre).css({'float': 'right'}) ); |
I'm 👎 on this. I don't think syntax highlighting can hurt, and those who religiously (or maybe even if for a good reason) can't stand it are much better off with a userscript that will unhighlight code blocks on all web pages (not just docs.perl6.org). |
Is there really a large number of users who'd find this feature useful? Feels like featuritis to me and those who are strongly bothered by the colors can add a single line of CSS to their user sheet. |
I think it's useful because it increases contrast by removing the colors and that's an important accessibility feature. |
There were problems with contrast in the past (#1084), please file a ticket if that is still an issue. But accessibility is not an argument for a toggle like this. Firefox has a built-in “reader mode” which does that already: It's fully a thing for user agents and we shouldn't be inventing our own. |
If this was an issue, I would probably be against. But it's a pull request, so he's bothered enough to put some work into it. So I'm not in principle against, but I have a couple of issues
On the other hand, come to think of it, a PR that does not really solve any issue is not such a good idea. I'm kind of with @AlexDaniel here. Let's not invent our own stuff. We can add some instructions somewhere if people really want to turn colors off, but that would be it (and whoever is annoyed by colors probably knows how to do it already...) |
So... what's the verdict? ping @timo |
I think we can close this. Maybe it'd make sense to have a short section somewhere titled “how to read these docs” and there we can explain how this can be done locally, but I'm not sure if it's worth it. Also, if current syntax highlighting is too colorful or has too low contrast, then we can tweak it (please open an issue or a PR). |
for people who can't stand syntax highlighting
for any reason.
It will remember the choice in sessionStorage, just like
debug mode, and will remove colors on page load if the
setting was turned on. Restoring colors is also possible
by just clicking the button again.
It'd be nice if someone with battle-tested JS knowledge could check if there's something wrong with the code, for example for older browsers.