Template:Color/doc

维基百科,自由的百科全书
跳转到导航 跳转到搜索


本模板用於取代HTML span的前景顏色。接受RGB的16進制編碼,例如:#C9E72A,或是任何的網頁顏色的英文名稱,如red, blue, green, moccasin, darkorchid。有關於HTML span的背景顏色,請參考{{background color}}

使用說明[编辑]

  • {{color|英文顏色名稱或是RGB 16進制編碼|文字}}

範例:

  • {{color|red|Hello, world!}} → Hello, world!
  • {{color|#00F000|Hello, world!}} → Hello, world!

如果第二個參數被省略,將會顯示下方文字:

  • {{color|#00F000}} → #00F000
  • {{color|red}} → red

處理效能[编辑]

本模板會產生下列的HTML span語法:

<span style="color:{{{1}}}">{{{2}}}</span>

處理速度大約每秒700次,與直接使用HTML語法幾乎沒有差異。

模板資料[编辑]

以下是该模板的模板数据,适用于可视化编辑器等工具。

Color模板数据

<templatedata> { "description": "The color template can be used to add a span of text with any given text color", "params": { "1": { "label": "Color", "description": "CSS name of color or hex code of color, e.g. 'red' or '#00F000'.", "type": "string", "required": true }, "2": { "label": "Text", "description": "The string of text to be formatted in the desired color", "type": "string", "suggested": true } } } </templatedata>

重定向[编辑]

参见[编辑]