Template:SpoilerBox: Difference between revisions

From Melvor Idle
(Adding title & color arguments.)
(Add special handling for color=default)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Template for embedding text in a spoiler box. Minimum syntax is {{T|SpoilerBox|text=internal text}} to get {{SpoilerBox|text=internal text}}.
Template for embedding text in a spoiler box. Minimum syntax is {{T|SpoilerBox|text=internal text}} to get {{SpoilerBox|text=internal text}}


There are also arguments for title & color, for example {{T|SpoilerBox|text=internal text|title=title|color=green}} gives {{SpoilerBox|text=internal text|title=title|color=green}}
There are also arguments for title & color, for example {{T|SpoilerBox|text=internal text|title=title|color=green}} gives {{SpoilerBox|text=internal text|title=title|color=green}}


<onlyinclude>{| class="wikitable mw-collapsible mw-collapsed"
The color argument also accepts 'default' as a special value, which causes the title text to remain as the default wiki text color. For example:
! style="color: {{{color|red}}};" | {{{title|The following content contains spoilers! Expand to view.}}}
 
{{T|SpoilerBox|text=internal text|title=Default text color|color=default}} gives {{SpoilerBox|text=internal text|title=Default text color|color=default}}
 
<onlyinclude><includeonly>{| class="wikitable mw-collapsible mw-collapsed"
! {{#ifeq:{{{color}}}|default||style="color: {{{color|red}}};"}} | {{{title|The following content contains spoilers! Expand to view.}}}
|-
|-
| {{{text}}}
| {{{text}}}
|}</onlyinclude>
|}</includeonly></onlyinclude>

Latest revision as of 01:27, 19 November 2021

Template for embedding text in a spoiler box. Minimum syntax is {{SpoilerBox|text=internal text}} to get

The following content contains spoilers! Expand to view.
internal text

There are also arguments for title & color, for example {{SpoilerBox|color=green|text=internal text|title=title}} gives

title
internal text

The color argument also accepts 'default' as a special value, which causes the title text to remain as the default wiki text color. For example:

{{SpoilerBox|color=default|text=internal text|title=Default text color}} gives

Default text color
internal text