当前位置:网站首页>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
边栏推荐
- Spark foundation -scala
- In simple terms, interview surprise Edition
- Low CPU load and high loadavg processing method
- How to access localhost:8000 by mobile phone
- Leetcode brush first_ Maximum Subarray
- LeetCode_格雷编码_中等_89.格雷编码
- Unbalance balance (dynamic programming, DP)
- short i =1; I=i+1 and short i=1; Difference of i+=1
- Blue Bridge Cup microbial proliferation C language
- 凤凰架构3——事务处理
猜你喜欢

Pay attention to the partners on the recruitment website of fishing! The monitoring system may have set you as "high risk of leaving"

Hudi vs Delta vs Iceberg

Tencent Android interview must ask, 10 years of Android development experience

Mysql Information Schema 学习(一)--通用表
腾讯T4架构师,android面试基础

Li Kou 101: symmetric binary tree

beegfs高可用模式探讨

面试突击63:MySQL 中如何去重?

腾讯Android面试必问,10年Android开发经验

After solving 2961 user feedback, I made such a change
随机推荐
凤凰架构2——访问远程服务
String长度限制?
The slave i/o thread stops because master and slave have equal MySQL serv
From spark csc. csr_ Matrix generate adjacency matrix
蓝桥杯 微生物增殖 C语言
ZABBIX proxy server and ZABBIX SNMP monitoring
Tensorflow2.0 self defined training method to solve function coefficients
Pay attention to the partners on the recruitment website of fishing! The monitoring system may have set you as "high risk of leaving"
Learning and Exploration - function anti shake
PHP与EXCEL PHPExcel
Low CPU load and high loadavg processing method
数据的同步为每个站点创建触发器同步表
理解 YOLOV1 第二篇 预测阶段 非极大值抑制(NMS)
Social recruitment interview experience, 2022 latest Android high-frequency selected interview questions sharing
VMware virtual machine cannot open the kernel device "\.\global\vmx86"
Using clip path to draw irregular graphics
Carte de réflexion + code source + notes + projet, saut d'octets + jd + 360 + tri des questions d'entrevue Netease
(3) Web security | penetration testing | basic knowledge of network security construction, IIS website construction, EXE backdoor generation tool quasar, basic use of
学习探索-函数防抖
社招面试心得,2022最新Android高频精选面试题分享