UNPKG
always-helper
Version:
latest (0.0.11)
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
前端项目开发中,经常会用到一些工具函数的合集。
github.com/Rabbitzzc/always
Rabbitzzc/always
always-helper
/
lib
/
color
/
hexToRgb.js
2 lines
(1 loc)
•
215 B
JavaScript
View Raw
1
2
export
default
function
(
n
){
return
"rgb("
+n.
replace
(
/^#?([a-f\d])([a-f\d])([a-f\d])$/i
,(
function
(
n,r,t,a
){
return
"#"
+r+r+t+t+a+a})).
substring
(
1
).
match
(
/.{2}/g
).
map
((
function
(
n
){
return
parseInt
(n,
16
)})).
join
(
", "
)+
")"
}