NGUI Label Color Code
文章目錄[點擊展開](?)[+]
UILabel的顏色代碼
NGUI的Label文檔:http://www.tasharen.com/?page_id=166
you can embed colors in [RrGgBb] format. For example, red color is [FF0000], green is [00FF00], etc. You can also use [-] to revert to a previous color. For example, the following text: “Hello [FF0000]World[-]!” will result in: Hello World!
就是說如果單個字體要變色需要使用十六進(jìn)制的顏色代碼,當(dāng)然如果你是修改整個Label的顏色就不需要這么麻煩了。
我的處理方法
下面說一下我的處理方式:
1、先把顏色定義寫在一個常量類中
public class GameDef {//NGUI Label 上的文字顏色 十六進(jìn)制代碼public const string NguiLbl_Color_Red = "[FF0000]";public const string NguiLbl_Color_Green = "[00FF00]";public const string NguiLbl_Color_Blue = "[0000FF]";public const string NguiLbl_Color_White = "[FFFFFF]";public const string NguiLbl_Color_Glod = "[FFD700]"; }//使用方法 Message =string.Format("武器庫超出了 {0}{1}[-] 件",GameDef.NguiLbl_Color_Red,overNum),2、在用的地方拼字符串。
?
所謂的RrGgBb 格式是這樣的
RR?? :??? 紅色值。十六進(jìn)制正整數(shù)
GG? :?? 綠色值。十六進(jìn)制正整數(shù)
BB?? :??? 藍(lán)色值。十六進(jìn)制正整數(shù)
以上三個參數(shù),取值范圍為:00 - FF。
參數(shù)必須是兩位數(shù)。對于只有一位的,應(yīng)在前面補(bǔ)零。
如果每個參數(shù)各自在兩位上的數(shù)字都相同,那么本單位也可縮寫為#RGB的方式。例如:#FF8800 可以縮寫為 #F80。
關(guān)于十六進(jìn)制顏色的更多信息,可以參考下面兩個網(wǎng)站:
W3C - 十六色色盤
?http://www.goodxyx.com/css/chm/z_color.html
HTML Color Codes
?http://www.rapidtables.com/web/color/html-color-codes.htm
本文轉(zhuǎn)自趙青青博客園博客,原文鏈接:http://www.cnblogs.com/zhaoqingqing/p/4151245.html,如需轉(zhuǎn)載請自行聯(lián)系原作者
總結(jié)
以上是生活随笔為你收集整理的NGUI Label Color Code的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: JavaScript———从setTim
- 下一篇: 关闭Outlook自动完成功能