跳至內容

模板:Hex3

維基百科,自由的百科全書


文件圖示 模板文件[檢視] [編輯] [歷史] [清除快取]

用法[編輯]

Converts three 8-bit numbers to hexadecimal. Useful for all sorts of color-related nefarious purposes. This template can be substituted.

輸入
  • 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).
輸出
  • a triplet of two-digit hex numbers

範例[編輯]

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

參見[編輯]

  • {{RGB}} for formating as a "rgb(r,g,b)" value
  • {{Hex2}} if you don't want three all at once.