Page MenuHomePhabricator

Consider removing purple color from template text
Closed, ResolvedPublic

Description

Reported on mw:Help talk:Extension:CodeMirror by @Alien333 and later requested by @stjn on Discord.

When a page makes heavy use of templates, most if not all text will appear as purple via .cm-mw-template (template values). Simply resetting the color here seems to produce much more readable wikitext.

Using en:Template:Non-free fair use as an example:

BeforeAfter
Screenshot from 2025-01-11 03-40-32.png (558×1 px, 205 KB)
Screenshot from 2025-01-11 03-41-05.png (558×1 px, 207 KB)

(ignore red underlines, that was just when the text had focus vs not)

And a modified version of wikisource:Page:Poems Odom.djvu/283:

BeforeAfter
Screenshot from 2025-01-11 04-04-25.png (749×606 px, 100 KB)
Screenshot from 2025-01-11 04-04-11.png (749×606 px, 102 KB)

The template page titles and parameter names still have the grounding, but you're not overwhelmed by a sea of purple.

This should be checked for accessibility compliance first, but I think it's otherwise a nice improvement that I imagine all users would appreciate.


Related and would still be valid if the above is implemented: T216210: Bold and italic template values are not bolded or italicized

Event Timeline

Change #1110051 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] CodeMirrorMediaWiki: remove @template-color from template values

https://gerrit.wikimedia.org/r/1110051

Change #1110051 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirrorMediaWiki: remove @template-color from template values

https://gerrit.wikimedia.org/r/1110051

Bhsd assigned this task to MusikAnimal.
Bhsd moved this task from Improvement to Done on the MediaWiki-extensions-CodeMirror board.

Change #1118771 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] CodeMirrorMediaWiki: rm dark mode styles applying color to template text

https://gerrit.wikimedia.org/r/1118771

Change #1118771 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CodeMirrorMediaWiki: rm dark mode styles applying color to template text

https://gerrit.wikimedia.org/r/1118771

I wish to say that, at least for me, the inside of templates being marked with a different colour improves readability when dealing with a lot of text.

on Wiktionary, it is way way harder to tell where the quotations end and where the definitions begin, as they are all in white and densely mixed together. on Wikipedia, I find it easier to orient myself between the many templates (infoboxes, references, images, quotations) and the body text with the use of purple.

image.png (646×697 px, 196 KB)

I wish to say that, at least for me, the inside of templates being marked with a different colour improves readability when dealing with a lot of text.

on Wiktionary, it is way way harder to tell where the quotations end and where the definitions begin, as they are all in white and densely mixed together. on Wikipedia, I find it easier to orient myself between the many templates (infoboxes, references, images, quotations) and the body text with the use of purple.

I gave the custom CSS on Discord, but to repeat here:

.cm-mw-template {
    color: #80c;
}
html.skin-theme-clientpref-night .cm-mw-template {
    color: #af84e6;
}
@media ( prefers-color-scheme: dark ) {
    html.skin-theme-clientpref-os .cm-mw-template {
        color: #af84e6;
    }
}

The point about Wiktionary concerns me. If a whole wiki would benefit from the original styles, I wonder if it should be a config setting. It could also be a CodeMirror preference, if we think users will want individual control over this.