Difference between revisions of "Template:Infobox/themes/style"

From Twinsuniverse
Jump to: navigation, search
m (testing substitution for themestyles)
(added infobox)
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{subst:#if: true |
+
<includeonly>{{#switch: {{lc:{{{1|}}}}}
{{safesubst:!}}tablestyle=border-color:{{{b|#ccc}}}; background-color:{{{bg|#fff}}};
+
| main = border-color:{{{b|#ccc}}}; background-color:{{{bg|#fff}}};
{{safesubst:!}}titlestyle=border-color:{{{b|#ccc}}}; background-color:{{{bgh|#ccf}}}; color:{{{txt|#000}}}; background-image:url({{{icon|}}});
+
| head = border-color:{{{b|#ccc}}}; background-color:{{{bgh|#ccf}}}; color:{{{txt|#000}}};
{{safesubst:!}}headstyle=border-color:{{{b|#ccc}}}; background-color:{{{bgh|#ccf}}}; color:{{{txt|#000}}};
+
| lead = border-color:{{{b|#ccc}}}; background-color:{{{bg|#fff}}}; color:{{{txt|#000}}};
{{safesubst:!}}datastyle=border-color:{{{b|#ccc}}};
+
| data = border-color:{{{b|#ccc}}};
}}</includeonly><noinclude>
+
| #default:
This template produces the appropriate theme for an <nowiki>{{</nowiki>[[Template:Infobox|infobox]]<nowiki>}}</nowiki>, by wrapping the specified values into dynamic parameters for the calling template-call.
+
}}</includeonly><noinclude>{{Infobox Template
 +
|purpose=infobox
 +
|singletag=no
 +
|multiline=no
 +
|gamerelated=no
 +
|suppressible=
 +
|choice=
 +
|cat1=
 +
|var1=
 +
}}
  
In simpler terms, this template tells another template how to make a particular theme, using the specified values.
+
This template produces one of four styles for particular {{templatelink|infobox/themes}}, in the form of CSS.
 
+
This template must be called using the '''safesubst:''' prefix, or it won't work.
+
 
+
{{stub}}
+
  
 
==Parameters==
 
==Parameters==
This template uses abbreviated parameter names, to allow for short(er) lines of code in the <nowiki>{{</nowiki>[[Template:Infobox/themes|Infobox/themes]]<nowiki>}}</nowiki> template, where all themes are specified per line.
+
This template uses abbreviated parameter names, to allow for short single lines when calling this template repetitively.
* '''b''': The colour of the '''b'''order
+
* '''b''': The '''b'''order colour
* '''bg''': The colour of the main '''b'''ack'''g'''round
+
* '''bg''': The main '''b'''ack'''g'''round colour
* '''bgh''': The colour of the '''b'''ack'''g'''round of '''h'''eadings
+
* '''bgh''': The '''b'''ack'''g'''round colour of '''h'''eaders
* '''txt''': The colour of '''t'''e'''xt''' in headings
+
* '''txt''': The '''t'''e'''xt''' colour in headers
* '''icon''': The url of the '''icon''' left of the title
+
  
This template also outputs the following parameters upon use to the calling template-call:
 
* '''tablestyle''': The theme style for the infobox' table element
 
* '''titlestyle''': The theme style for the infobox' title heading
 
* '''headstyle''': The theme style for the infobox' headings (header and label)
 
* '''datastyle''': The theme style for the infobox' plain data cells
 
  
 +
'''''Note''': The colours may be in any CSS accepted format, that is #RGB, #RRGGBB, rgb(xxx,xxx,xxx) or string literal.''
  
'''''Note''': The colours may be in any CSS accepted format, that is #RGB, #RRGGBB, rgb(xxx,xxx,xxx) or string literal.''
 
  
'''''Note''': To get the url for the '''icon''' parameter, search for the icon in [[:Category:Icons]], click it to open it's file page, and then right-click on the link of the filename below the full-sized image to copy the link address. Then remove everything before "/images/".''
+
# The particular style that should be formed is also required (no parameter name, case insensitive), should be one of the following:
 +
#* ''main'' (the infobox' main table style)
 +
#* ''head'' (the infobox' default header style; title, subtitle and labels)
 +
#* ''lead'' (the infobox' alternate header style; heading)
 +
#* ''data'' (the infobox' plain data cell style)
 +
#* any other value results in an empty string as output.
  
 
==Syntax==
 
==Syntax==
  <nowiki>{{safesubst:Infobox/theme
+
  <nowiki>{{Infobox/themes/style|style
 
  |b=
 
  |b=
 
  |bg=
 
  |bg=
 
  |bgh=
 
  |bgh=
 
  |txt=
 
  |txt=
|icon=
 
 
}}</nowiki>
 
}}</nowiki>
  
 
==Example==
 
==Example==
  <nowiki>{{safesubst:Infobox/theme
+
  <nowiki>{{Infobox/themes/style|main
 
  |b=red
 
  |b=red
 
  |bg=#efe
 
  |bg=#efe
 
  |bgh=#ababab
 
  |bgh=#ababab
 
  |txt=rgb(50,60,70)
 
  |txt=rgb(50,60,70)
|icon=/images/6/6e/Orb_grey30.png
 
 
}}</nowiki>
 
}}</nowiki>
  
The result would be a custom theme for an infobox.
+
The output would be pure CSS, acceptable for the HTML '''style''' attribute, in this example the specific attributes required for the 'main' element.
  
[[Category:System Templates]]
 
[[Category:Infoboxes| ]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 22:31, 4 June 2014

Infobox/themes/style
Purpose

Infobox [list all]

Single tag

No [list all]

Multi-line

No [list all]

Protected

No [list all]

Game related

No [list all]

Categorization
Categories

none [list all]

Variables
Names

none [list all]

Subpages

This template produces one of four styles for particular {{infobox/themes}}, in the form of CSS.

Parameters

This template uses abbreviated parameter names, to allow for short single lines when calling this template repetitively.

  • b: The border colour
  • bg: The main background colour
  • bgh: The background colour of headers
  • txt: The text colour in headers


Note: The colours may be in any CSS accepted format, that is #RGB, #RRGGBB, rgb(xxx,xxx,xxx) or string literal.


  1. The particular style that should be formed is also required (no parameter name, case insensitive), should be one of the following:
    • main (the infobox' main table style)
    • head (the infobox' default header style; title, subtitle and labels)
    • lead (the infobox' alternate header style; heading)
    • data (the infobox' plain data cell style)
    • any other value results in an empty string as output.

Syntax

{{Infobox/themes/style|style
 |b=
 |bg=
 |bgh=
 |txt=
}}

Example

{{Infobox/themes/style|main
 |b=red
 |bg=#efe
 |bgh=#ababab
 |txt=rgb(50,60,70)
}}

The output would be pure CSS, acceptable for the HTML style attribute, in this example the specific attributes required for the 'main' element.