当前位置:网站首页>13 essential methods of color!
13 essential methods of color!
2022-07-24 18:12:00 【Solution without encirclement】
Color 13 Necessary methods !
Randomly generate hexadecimal colors
// Randomly generate hexadecimal colors
const randomHexColorCode = () => {
let n = (Math.random() * 0xfffff * 1000000).toString(16);
return "#" + n.slice(0, 6);
};
// Use
randomHexColorCode(); // '#e34155'
RGB To hexadecimal
//RGB To hexadecimal
const RGBToHex = (r, g, b) =>
((r << 16) + (g << 8) + b).toString(16).padStart(6, "0");
// Use
RGBToHex(255, 165, 1); // '#ffa501'
take 3 The bit color is extended to 6 Bit color
// take Hexadecimal 3 The bit color is extended to 6 Bit color
const extendHex = (shortHex) =>
"#" +
shortHex
.slice(shortHex.startsWith("#") ? 1 : 0)
.split("")
.map((x) => x + x)
.join("");
// Use
extendHex("#03f"); // '#0033ff'
extendHex("05a"); // '#0055aa'
take rgb() The color string is converted to an object with each color value .
// take rgb() The color string is converted to a 边栏推荐
- Is header file required? Follow the compilation process~~~
- Install jumpserver
- 还在用命令行看日志?快用Kibana吧,可视化日志分析YYDS!
- 【obs】依赖库: x264 vs 构建
- 0611~ self study class
- 0627~ holiday knowledge summary
- Section 11 cache avalanche, hot data failure follow Daewoo redis ------- directory post
- JS数组方法 sort() 排序规则解析
- Common methods of number and math classes
- 1688/阿里巴巴按关键字搜索新品数据 API 使用说明
猜你喜欢

Pay close attention! List of the latest agenda of 2022 open atom open source Summit

Mozilla foundation released 2022 Internet health report: AI will contribute 15.7 trillion yuan to the global economy in 2030, and the investment in AI in the United States last year was nearly three t

模拟实现vector

【“码”力全开,“章”显实力】2022年第1季Task挑战赛贡献者榜单

jmeter --静默运行

C language custom type explanation - structure

PXE高效批量网络装机

05mysql lock analysis

0625~<config>-<bus>

Use prometheus+grafana to monitor MySQL performance indicators
随机推荐
数组常用方法(2)
Three ways of redis cluster
steam API
2.3.1 view drawing process
0612~quartz timer frame
Shengxin commonly used analysis graphics drawing 02 -- unlock the essence of volcano map!
Codeforces Round #794 (Div. 2)(A.B.C)
Section 9 cache penetration follow Daewoo redis ------- directory posts
JMeter -- prometheus+grafana server performance visualization
In depth analysis of the famous Alibaba cloud log4j vulnerability
Int8 & int8, have you ever stumbled like this?
IO multiplexing
Use prometheus+grafana to monitor MySQL performance indicators
Ship new idea 2022.2 was officially released, and the new features are really fragrant!
sklearn 的模型保存与加载使用
Inherit, override, overload
jmeter --静默运行
[OBS] dependency Library: x264 vs Build
1688/ Alibaba searches new product data by keyword API instructions
0616 end of Project II ~ ~ general summary