Jump to content

Topic on VisualEditor/Feedback

47.25.203.51 (talkcontribs)

It has been said that there is no Mediawiki need for text colourization or highlighting.


For uses outside of traditional Mediawiki use this may not be true. In a similar way that underlining, line through or bolding adds meaning to a text, so can the addition of colour.

For example. I live on very complex searchable ToDo lists. For years, I used a bar of highlighter colour on the paper version to indicate action, urgency and status. Its is far faster and much more accurate to scan a large document for a colour than to read a descriptive text.

That was when I used paper. The use of colour on paper is in some ways superior to a computer screen.

Mediawiki used as a newspaper or library book for text retrieval only may have no need for text colour and highlighting. But I suspect, there are many who would find it extraordinarily useful.


TheDJ (talkcontribs)

While true, most developers only work on MediaWiki for Wikimedia purposes. As such you likely need to do the development yourself.

Alsee (talkcontribs)

I don't think VisualEditor directly supports color, but wikitext does support both text color and background color:

  • <span style="color:red">red text</span>
    • red text
  • <span style="color:yellow; background-color: blue">yellow text on blue background</span>
    • yellow text on blue background
  • <span style="color: #99BBDD; background-color: #663300">Color #99BBDD text on color #663300 background</span>
    • Color #99BBDD text on color #663300 background

You can also create a template to handle text colors. Then you'd be about to work in VisualEditor adding the template or editing the colors or the text.

The simplest template would probably just contain:

  • <span style="color: {{{1}}}">{{{2}}}</span>

It would be used like: {{textcolor red|This text is red.}} or {{text color #0088aa|This text is greenish-blue.}}

If you want a template for both text color and background color:

  • <span style="background-color: {{{1}}}; color: {{{2}}}">{{{3}}}</span>

It would be used like {{textcolor blue|yellow|This is yellow text on a blue background.}} It can of course also be used with # color values.

Many wikis have a template like this, and it often has fancier features (and more complicated template code). Here's a list of links to versions of this template on various wikis. You can copy one of those templates if you want the increased functionality.

Rowe Wilson Frederisk Holme (talkcontribs)

Agree. And in addition, some data tables require color filling to use templates, but inserting a color-filled template into the visual editor can cause some weird display errors.

Epopen (talkcontribs)

Text colorization work fine as follows

<span style="color: rgb(255, 0, 0);">BARFOO</span>

But won't work when CSP @ http server added as follows

Header always set Content-Security-Policy "default-src 'none'; connect-src 'self'; font-src 'self'; img-src 'self'; require-trusted-types-for 'script'; script-src 'self'; style-src 'self'"

Got debug message @ firefox as follows

Content-Security-Policy: The page’s settings blocked the loading of a resource at inline (“style-src”).

Source: color: rgb(255, 0, 0);


I googled, tried to add nonce into style-src directive as follows

Header always set Content-Security-Policy .... style-src 'self' 'nonce-rAnd0m';

Either

<span style="color: rgb(255, 0, 0); nonce="rAnd0m";">BARFOO</span>

Or

<span style="color: rgb(255, 0, 0);" nonce="rAnd0m">BARFOO</span>

But won't work.


Can help to debug and fix the problem?

Thanks a lot.

Reply to "Text colourization"