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!

就是说如果单个字体要变色需要使用十六进制的颜色代码,当然如果你是修改整个Label的颜色就不需要这么麻烦了。

我的处理方法

下面说一下我的处理方式:

1、先把颜色定义写在一个常量类中

复制代码
public class GameDef
{
    //NGUI Label 上的文字颜色 十六进制代码
    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   :    红色值。十六进制正整数
GG  :   绿色值。十六进制正整数
BB   :    蓝色值。十六进制正整数


以上三个参数,取值范围为:00 - FF。
参数必须是两位数。对于只有一位的,应在前面补零。
如果每个参数各自在两位上的数字都相同,那么本单位也可缩写为#RGB的方式。例如:#FF8800 可以缩写为 #F80。

关于十六进制颜色的更多信息,可以参考下面两个网站:

W3C - 十六色色盘

 http://www.goodxyx.com/css/chm/z_color.html

image

HTML Color Codes

 http://www.rapidtables.com/web/color/html-color-codes.htm

image

本文转自赵青青博客园博客,原文链接:http://www.cnblogs.com/zhaoqingqing/p/4151245.html,如需转载请自行联系原作者


相关文章
|
7月前
24Echarts - 折线图(Line Style and Item Style)
24Echarts - 折线图(Line Style and Item Style)
25 0
|
7月前
SAP UI5 Responsive Grid Layout 里的 Label-Field Ratio 在屏幕类型 S 下的表现
对于 SAP UI5 SimpleForm 的每种尺寸,我们可以定义用于标签(labelSpanXL、labelSpanL、labelSpanM、labelSpanS)、字段(隐式)和空网格列(emptySpanXL、emptySpanL、emptySpanM、emptySpanS)的网格列数。
24 0
Figma|Generate color palette
Figma|Generate color palette
85 0
|
前端开发 JavaScript API
How to change the background color of button in Footer area
How to change the background color of button in Footer area
105 0
How to change the background color of button in Footer area
SAP UI5 dialog style max-height
Created by Wang, Jerry, last modified on Apr 09, 2015
103 0
SAP UI5 dialog style max-height
|
Web App开发
<span style="font-weight:normal;">其他请<a href="http://blog.csdn.net/odailidong/article/details/72943877">参考: App统计指标定义</a></span>
(一)流量统计   1. 独立用户数:在当前计算周期内,访问统计对象的不重复用户数。万瑞数据系统通过对用户所使用的浏览器赋予唯一标识来识别用户的身份。
783 0
|
Web App开发 测试技术