Template:Swatch: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
m (documentation & categorization)
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
<div style="background:rgb({{{1}}}); color: #{{{2|000000}}}; text-align: center; border: {{{b|0}}}px solid" title="{{{t|({{{1}}})}}}">
<div style="background:#{{{1}}}; color: #{{{2|000000}}}; text-align: center; padding:6px; padding-top:1px; padding-bottom:1px; border: {{{b|0}}}px solid; width:{{{w|1.5em}}};" title="{{{3|#{{{1}}}}}}"><tt style="font-size:0.5em;">{{{3|#{{{1}}}}}}</tt></div>
<noinclude>[[Category:Template]]
<tt style="font-style:normal"> ({{{1}}}) </tt></div>
This template makes an rgb color swatch, as css colors. On Windows these will appear as sRGB. They will not look correct on a Mac.


It takes 3 positional arguments, hex rgb color and an optional text color (default black), and an optional title/content string, b = border
<noinclude>


== Sample usage ==
This template makes an rgb color swatch, as css colors. On Windows these will appear as sRGB. They will not look correct on a Mac.

<tt>
<nowiki>{{</nowiki>swatch | ''background_color_hex'' | ''color_hex'' | ''title_text''
| w = ''width_em / defaults to 1.5em''
| b = ''border / defaults to 0''<nowiki>}}</nowiki></tt>


{|
It takes a positional argument, which is the rgb color, and then it takes 2 named arguments, b = border, and t = title
|-
| <tt><nowiki>{{swatch | FFFFFF | B5B5B5 | 255 255 255 | w = 6em}}</nowiki></tt>
| {{swatch|FFFFFF|B5B5B5|255 255 255|w=6em}}
|-
| <tt><nowiki>{{swatch | 54E2AE | 616161 | 84 226 174}}</nowiki></tt>
| {{swatch|54E2AE|616161|84 226 174 }}
|-
| <tt><nowiki>{{swatch | 138C68 | 222222 | 19 140 104}}</nowiki></tt>
| {{swatch|138C68|222222|19 140 104}}
|}


</noinclude>
</noinclude>

Latest revision as of 14:43, 15 April 2007

#{{{1}}}

This template makes an rgb color swatch, as css colors. On Windows these will appear as sRGB. They will not look correct on a Mac.

It takes 3 positional arguments, hex rgb color and an optional text color (default black), and an optional title/content string, b = border

Sample usage

 {{swatch | background_color_hex | color_hex | title_text 
          | w = width_em / defaults to 1.5em 
          | b = border / defaults to 0}}
{{swatch | FFFFFF | B5B5B5 | 255 255 255 | w = 6em}}
255 255 255
{{swatch | 54E2AE | 616161 | 84 226 174}}
84 226 174
{{swatch | 138C68 | 222222 | 19 140 104}}
19 140 104