Template:Swatch: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
m (documentation & categorization)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
<div style="background:#{{{1}}}; color: #{{{2|000000}}}; text-align: center; border: {{{b|0}}}px solid" title="{{{3|#{{{1}}}}}}"><tt style="font-size:0.5em;">{{{3|#{{{1}}}}}}</tt></div>
<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>
<noinclude>[[Category:Template]]
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.
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
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 ==

<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>

{|
|-
| <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