RGB转16进制颜色码
来源:互联网 发布:鼎捷软件千股千评 编辑:程序博客网 时间:2024/05/18 13:05
class DATA {
private static instance: DATA;
private Map:Array<string>=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
public constructor() {
}
public static getInstance(): DATA {
if (!this.instance) {
this.instance = new DATA();
}
return this.instance;
}
public RGB2HEX16(R: number, G: number, B: number): string {
var result_string: Array<string>=new Array();
result_string.push("0x");
result_string.push(this.Map[(R / 16)]);
result_string.push(this.Map[(R % 16)]);
result_string.push(this.Map[(G / 16)]);
result_string.push(this.Map[(G % 16)]);
result_string.push(this.Map[(B / 16)]);
result_string.push(this.Map[(B % 16)]);
return result_string.join("");
}
}
private static instance: DATA;
private Map:Array<string>=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
public constructor() {
}
public static getInstance(): DATA {
if (!this.instance) {
this.instance = new DATA();
}
return this.instance;
}
public RGB2HEX16(R: number, G: number, B: number): string {
var result_string: Array<string>=new Array();
result_string.push("0x");
result_string.push(this.Map[(R / 16)]);
result_string.push(this.Map[(R % 16)]);
result_string.push(this.Map[(G / 16)]);
result_string.push(this.Map[(G % 16)]);
result_string.push(this.Map[(B / 16)]);
result_string.push(this.Map[(B % 16)]);
return result_string.join("");
}
}
0 0
- RGB转16进制颜色码
- rgb颜色转16进制格式的代码
- JavaScript原生16进制颜色值转RGB值
- [iOS 16进制颜色转换RGB](转)
- RGB颜色与16进制颜色的换算方法
- RGB颜色与16进制颜色的换算方法
- RGB颜色与16进制颜色的换算方法
- iOS 16进制颜色转化为rgb 颜色
- js代码将rgb颜色转为16进制颜色
- RGB颜色如何转变成16进制颜色
- 10进制颜色码转换成RGB颜色值
- iOS开发16进制颜色转10进制RGB颜色
- 16进制 转RGB颜色
- 16进制颜色转换为RGB色值
- 将16进制颜色转换成RGB值
- iOS 16进制颜色转换成RGB
- IOS 将16进制颜色转换成RGB
- C#RGB颜色与16进制之间的转换
- Ibatis代码自动生成工具
- 浅谈网站优化
- CSS小技巧
- 剑指Offer之 - 合并两个排序的链表
- 如何选择和阅读研究文献
- RGB转16进制颜色码
- ios 通过经纬度定位城市,通过城市名定位经纬度
- Sqlite官方说明文档
- Android TextView 添加连接方式
- 绘图2
- ant build.xml教程详解
- 【BZOJ 1531】 [POI2005]Bank notes
- 浩易南:喝酒请客的艺术
- SpringMVC的注解和jQuery的配合使用