Difference between revisions of "Template:Hex3/doc"

From blackwiki
Jump to navigation Jump to search
imported>Verdy p
m
imported>Verdy p
m
Line 12: Line 12:
  
 
; Example
 
; Example
:* <tt><nowiki>{{hex3|0|0|0}}</nowiki></tt>
+
:* <tt><nowiki>{{hex3|0|0|0}}</nowiki></tt>gives {{hex3|0|0|0}}
:: gives       {{hex3|0|0|0}} (this should be #000000)
+
:* <tt><nowiki>{{subst:hex3|0|0|0|subst=subst:}}</nowiki></tt> gives #000000
:* <tt><nowiki>{{subst:hex3|0|0|0|subst=subst:}}</nowiki></tt>
+
:* <tt><nowiki>{{hex3|123|45|67}}</nowiki></tt> gives {{hex3|123|45|67}}
:: gives       #000000
+
:* <tt><nowiki>{{subst:hex3|123|45|67|subst=subst:}}</nowiki></tt>gives #7B2D43
:* <tt><nowiki>{{subst:hex3|123|45|67|subst=subst:}}</nowiki></tt>
+
:* <tt><nowiki>{{hex3|255|255|255}}</nowiki></tt> gives {{hex3|255|255|255}}
:: gives       {{hex3|123|45|67}} (this should be #7B2D43)
+
:* <tt><nowiki>{{subst:hex3|255|255|255|subst=subst:}}</nowiki></tt> gives #FFFFFF
:* <tt><nowiki>{{subst:hex3|123|45|67|subst=subst:}}</nowiki></tt>
 
:: gives       #7B2D43
 
:* <tt><nowiki>{{hex3|255|255|255}}</nowiki></tt>
 
:: gives       {{hex3|255|255|255}} (this should be #FFFFFF)
 
:* <tt><nowiki>{{subst:hex3|255|255|255|subst=subst:}}</nowiki></tt>
 
:: gives       #FFFFFF
 
  
 
; See also
 
; See also

Revision as of 12:40, 9 December 2008

Description of use
Converts three 8-bit numbers to hexadecimal.
Useful for all sorts of color-related nefarious purposes.
Input
  • three parameters, each numeric in the range 0..255 (larger numbers will wrap around)
  • #= (optional) allows you to change or remove the prefix for hex numbers (such as #) ; the default prefix is #.
  • subst=subst: (optional) allows to perform a permanent substitution of the internal sub-expressions (or subtemplates that may be used), and keep only the result of the evaluations when saving a page using this template. You should pass this parameter in addition to calling the template using the "subst:" prefix that just performs a permanent template expansion and permanent substitution of parameters. (See examples below).
Output
  • a triplet of two-digit hex numbers
Example
  • {{hex3|0|0|0}}gives #000000
  • {{subst:hex3|0|0|0|subst=subst:}} gives #000000
  • {{hex3|123|45|67}} gives #7B2D43
  • {{subst:hex3|123|45|67|subst=subst:}}gives #7B2D43
  • {{hex3|255|255|255}} gives #FFFFFF
  • {{subst:hex3|255|255|255|subst=subst:}} gives #FFFFFF
See also
  • {{rgb}} for formating as a "rgb(r,g,b)" value
  • {{hex}} if you don't want three all at once.