DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:color

This is an old revision of the document!


color Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Opportunity to write colored text in DokuWiki

Last updated on
2022-10-16
Provides
Syntax
Repository
Source

Installation

Please use the extension manager to install the plugin, no configuration needed.

Usage

Place this code sample in your playground:

<color green>text</color>
<color blue/lightgrey>text</color>
<color #FF0000>text</color>
<color /#FFff00>text</color>
<color rgb(80%,0%,0%)/rgb(100%,80%,100%)>text</color>
<color hsl(120,100%,30%)/hsl(180,50%,90%)>text</color>

and you will see something like this:

Color plugin in action

More precisely, allowed syntax is one of

<color ⟨fg-color⟩>⟨text⟩</color>
<color ⟨fg-color⟩/⟨bg-color⟩>⟨text⟩</color>
<color /⟨bg-color⟩>⟨text⟩</color>

The result is ⟨text⟩ shown with foreground color ⟨fg-color⟩ and background color ⟨bg-color⟩. If either color is omitted, the color of the surrounding text is used.

This plugin now allows any color specification not containing single or double quotes or any of the symbols < > & ; / . It does not try to check if the specification is valid CSS. This is to accommodate the CSS 4 color specifications, as well as any future color specifications – so long as they do not use any of the “forbidden” characters.

For a reference of usable color specifications, see the color page at developer.mozilla.org. Beware that not all color specifications work on all browsers. See the bottom of the referenced page for more information, or check Can I Use if in doubt.

  • The plugin works by wrapping contents in a <span> element with a suitable style attribute. Therefore, you cannot wrap it around block level items such as headers, lists, and tables.
  • You cannot use it inside headers either, since you can't use wiki syntax within a header.

Discussion

This source for this plugin is shown in the Sample Plugin Tutorial.

Development

Christopher Smith seems to have left the plugin unmaintained. User leeyc0 provided hosting of the plugin on github, but has no time to maintain it either. Harald Hanche-Olsen took over in October 2018. The plugin is considered fairly stable, though, and the new maintainer does not foresee a very active maintenance schedule. New feature requests will likely be rejected.

Update History

  • 2022-09-15 Removed deprecated and unnecessary (but harmless) code
  • 2018-10-12 New maintainer
  • 2018-10-10 Added support for rgb[a](…) and hsl[a](…) color specifications
  • 2018-08-09 Added code for handling metadata to the render method
  • 2016-06-25 Added ODT support based on branch “redesign”
  • 2014-01-04 hosted in github by leeyc0
  • 2008-02-06 — Fixed a security vulnerability in the colour pattern. Any users of this plugin should apply this update. — Christopher Smith 2008-02-06 17:20
plugin/color.1666166619.txt.gz · Last modified: 2022-10-19 10:03 by hanche

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki