Difference between revisions of "Template:Hex3/doc"

From blackwiki
Jump to navigation Jump to search
imported>Borgx
m (+id)
imported>Amalthea
(Use safesubst: (meta:Help:Safesubst))
Line 2: Line 2:
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. -->
 
; Description of use
 
; Description of use
: Converts three 8-bit numbers to hexadecimal.
+
: Converts three 8-bit numbers to hexadecimal. Useful for all sorts of color-related nefarious purposes.
: Useful for all sorts of color-related nefarious purposes.
+
: This template can be substituted.
  
 
; Input
 
; Input
 
:* three parameters, each numeric in the range 0..255 (larger numbers will wrap around)
 
:* three parameters, each numeric in the range 0..255 (larger numbers will wrap around)
:* <tt>#=</tt> ''(optional)'' allows you to change or remove the prefix for hex numbers (such as #) ; the default prefix is " #" (with a leading space to avoid the internal interpretation by MediaWiki as a numbered list item when returning the value from the template ; this space does nos alter the CSS validity of the value).
+
:* <tt>#=</tt> ''(optional)'' allows you to change or remove the prefix for hex numbers (such as #) ; the default prefix is " #" (with a leading space to avoid the internal interpretation by MediaWiki as a numbered list item when returning the value from the template; this space does not alter the CSS validity of the value).
:* <tt>subst=subst:</tt> ''(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
 
; Output
Line 15: Line 14:
 
; Examples
 
; Examples
 
:* <tt><nowiki>{{Hex3|0|0|0}}</nowiki></tt>gives {{Hex3|0|0|0}}
 
:* <tt><nowiki>{{Hex3|0|0|0}}</nowiki></tt>gives {{Hex3|0|0|0}}
:* <tt><nowiki>{{subst:Hex3|0|0|0|subst=subst:}}</nowiki></tt> gives  #000000
+
:* <tt><nowiki>{{subst:Hex3|0|0|0}}</nowiki></tt> gives  #000000
 
:* <tt><nowiki>{{Hex3|123|45|67}}</nowiki></tt> gives {{Hex3|123|45|67}}
 
:* <tt><nowiki>{{Hex3|123|45|67}}</nowiki></tt> gives {{Hex3|123|45|67}}
:* <tt><nowiki>{{subst:Hex3|123|45|67|subst=subst:}}</nowiki></tt>gives  #7B2D43
+
:* <tt><nowiki>{{subst:Hex3|123|45|67}}</nowiki></tt>gives  #7B2D43
 
:* <tt><nowiki>{{Hex3|255|255|255}}</nowiki></tt> gives {{Hex3|255|255|255}}
 
:* <tt><nowiki>{{Hex3|255|255|255}}</nowiki></tt> gives {{Hex3|255|255|255}}
:* <tt><nowiki>{{subst:Hex3|255|255|255|subst=subst:}}</nowiki></tt> gives  #FFFFFF
+
:* <tt><nowiki>{{subst:Hex3|255|255|255}}</nowiki></tt> gives  #FFFFFF
  
 
; See also
 
; See also

Revision as of 10:23, 23 April 2010

Description of use
Converts three 8-bit numbers to hexadecimal. Useful for all sorts of color-related nefarious purposes.
This template can be substituted.
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 " #" (with a leading space to avoid the internal interpretation by MediaWiki as a numbered list item when returning the value from the template; this space does not alter the CSS validity of the value).
Output
  • a triplet of two-digit hex numbers
Examples
  • {{Hex3|0|0|0}}gives #000000
  • {{subst:Hex3|0|0|0}} gives #000000
  • {{Hex3|123|45|67}} gives #7B2D43
  • {{subst:Hex3|123|45|67}}gives #7B2D43
  • {{Hex3|255|255|255}} gives #FFFFFF
  • {{subst:Hex3|255|255|255}} gives #FFFFFF
See also
  • {{RGB}} for formating as a "rgb(r,g,b)" value
  • {{Hex2}} if you don't want three all at once.