Skip to main content
  1. Snippits & Exemplars/
  2. WolfspyreLabs Exemplars/
  3. WolfspyreLabs Shortcodes/

Color

🐺 Color
Show a bit of color

I found this post1 on how to make a shortcode which shows a given color.
It does this by creating a small code+span element:
like this: <code><span>some color-styled text here</span></code>
I’ve re-implemented it in two different ways. The first is this shortcode:

๐ŸŽจ

Position Parameter Default Behavior
0 color N/A Populates the css color:2 attribute of the <span> element created
1 colortext color The text within the span element. Defaults to the value passed to the color parameter
๐ŸŽจ

Positional usage #

๐ŸŽจ
{{< color “blue” >}}
Should display the specified color : blue
Should display the color with the specified text overlayed
not blue
{{< color “blue” “not blue” >}}

Named Parameter usage #

๐ŸŽจ

Should work as expected: blue
{{< color color=“blue” >}}
{{< color color=“blue” colortext=“not blue” >}}
Should work as expected: not blue
๐ŸŽจ

This is managed by the file layouts/shortcodes/color.html

There is also the jewel variant of this shortcode.
That’s managed through the file layouts/shortcodes/jewel.html