当前位置:网站首页>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
边栏推荐
- 《数字经济全景白皮书》保险数字化篇 重磅发布
- POJ1149 PIGS 【最大流量】
- 腾讯T3大牛手把手教你,大厂内部资料
- Finally, there is no need to change a line of code! Shardingsphere native driver comes out
- 在解决了 2961 个用户反馈后,我做出了这样的改变...
- 121. 买卖股票的最佳时机
- 句号压缩过滤器
- Vscode debug run fluent message: there is no extension for debugging yaml. Should we find yaml extensions in the market?
- Lick the dog until the last one has nothing (simple DP)
- [translation] Digital insider. Selection process of kubecon + cloudnativecon in Europe in 2022
猜你喜欢

思維導圖+源代碼+筆記+項目,字節跳動+京東+360+網易面試題整理

社招面试心得,2022最新Android高频精选面试题分享

学习打卡web

Zero foundation entry polardb-x: build a highly available system and link the big data screen

Configuration and simple usage of the EXE backdoor generation tool quasar

利用 clip-path 绘制不规则的图形

DaGAN论文解读

How to access localhost:8000 by mobile phone

beegfs高可用模式探讨

语音识别(ASR)论文优选:全球最大的中英混合开源数据TALCS: An Open-Source Mandarin-English Code-Switching Corpus and a Speech
随机推荐
MySQL information schema learning (II) -- InnoDB table
Cf960g - bandit Blues (type I Stirling number +ogf)
(3) Web security | penetration testing | basic knowledge of network security construction, IIS website construction, EXE backdoor generation tool quasar, basic use of
凤凰架构2——访问远程服务
新一代垃圾回收器—ZGC
HDU 1026 search pruning problem within the labyrinth of Ignatius and the prince I
Leetcode 30. 串联所有单词的子串
爬虫(14) - Scrapy-Redis分布式爬虫(1) | 详解
Lick the dog until the last one has nothing (simple DP)
算法面试经典100题,Android程序员最新职业规划
Using clip path to draw irregular graphics
Systematic and detailed explanation of redis operation hash type data (with source code analysis and test results)
CF960G - Bandit Blues(第一类斯特林数+OGF)
After solving 2961 user feedback, I made such a change
范式的数据库具体解释
Mind map + source code + Notes + project, ByteDance + JD +360+ Netease interview question sorting
Vmware虚拟机无法打开内核设备“\\.\Global\vmx86“的解决方法
The slave i/o thread stops because master and slave have equal MySQL serv
Logstash expressway entrance
激进技术派 vs 项目保守派的微服务架构之争