当前位置:网站首页>Color is converted to tristimulus value (r/g/b) (dry stock)
Color is converted to tristimulus value (r/g/b) (dry stock)
2022-07-06 19:50:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
// Color conversion ##665522 — Trichromatic value + ( UIColor *)setFontColorWithString:( NSString *)color { NSString *cString = [[color stringByTrimmingCharactersInSet :[ NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString]; // The number of strings must be greater than or equal to 6 if ([cString length] < 6) { return [UIColorclearColor]; } // basis 16 Base to distinguish if ([cString hasPrefix:@”0X”]) cString = [cString substringFromIndex:2]; if ([cString hasPrefix:@”#”]) cString = [cString substringFromIndex:1]; if ([cString length] != 6) return [UIColorclearColor]; // It is divided into r,g,b Substring NSRange range; range.location = 0; range.length = 2; //r NSString *rString = [cString substringWithRange:range]; //g range.location = 2; NSString *gString = [cString substringWithRange:range]; //b range.location = 4; NSString *bString = [cString substringWithRange:range]; // scanning r,g,b value unsignedint r, g, b; [[NSScannerscannerWithString:rString] scanHexInt:&r]; [[NSScannerscannerWithString:gString] scanHexInt:&g]; [[NSScannerscannerWithString:bString] scanHexInt:&b]; return RgbHex2UIColor(r, g, b);
}
Copyright notice : This article is an original blog article , Blog , Without consent , Shall not be reproduced .
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117138.html Link to the original text :https://javaforall.cn
边栏推荐
- From spark csc. csr_ Matrix generate adjacency matrix
- Alibaba data source Druid visual monitoring configuration
- 凤凰架构3——事务处理
- Yyds dry goods inventory leetcode question set 751 - 760
- 社招面试心得,2022最新Android高频精选面试题分享
- 【云小课】EI第47课 MRS离线数据分析-通过Flink作业处理OBS数据
- 学习探索-函数防抖
- Hudi vs Delta vs Iceberg
- 在解决了 2961 个用户反馈后,我做出了这样的改变...
- [translation] linkerd's adoption rate in Europe and North America exceeded istio, with an increase of 118% in 2021.
猜你喜欢
Standardized QCI characteristics
理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
《数字经济全景白皮书》保险数字化篇 重磅发布
Learning and Exploration - Seamless rotation map
[play with Linux] [docker] MySQL installation and configuration
Spark foundation -scala
【翻译】Linkerd在欧洲和北美的采用率超过了Istio,2021年增长118%。
企业精益管理体系介绍
The "white paper on the panorama of the digital economy" has been released with great emphasis on the digitalization of insurance
如何自定义动漫头像?这6个免费精品在线卡通头像生成器,看一眼就怦然心动!
随机推荐
Alibaba数据源Druid可视化监控配置
Alibaba data source Druid visual monitoring configuration
如何自定义动漫头像?这6个免费精品在线卡通头像生成器,看一眼就怦然心动!
Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?
beegfs高可用模式探讨
Logstash expressway entrance
Example of shutter text component
DOM operation
POJ1149 PIGS 【最大流量】
手把手教你学会js的原型与原型链,猴子都能看懂的教程
【翻译】Linkerd在欧洲和北美的采用率超过了Istio,2021年增长118%。
Li Kou 101: symmetric binary tree
LeetCode_双指针_中等_61. 旋转链表
[translation] linkerd's adoption rate in Europe and North America exceeded istio, with an increase of 118% in 2021.
学习探索-无缝轮播图
Leetcode 30. Concatenate substrings of all words
广州首个数据安全峰会将在白云区开幕
转让malloc()该功能后,发生了什么事内核?附malloc()和free()实现源
In depth analysis, Android interview real problem analysis is popular all over the network
MySql必知必会学习