In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I will talk to you about the conversion between hexadecimal and RGB color values and how to judge a prime number and inline function and object-oriented. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents. I hope you can get something from this article.
Conversion between hexadecimal and RGB color values
/ * *
* randomly generate colors
* @ return randomly generated hexadecimal colors
, /
Function randomColor () {
Var colorStr=Math.floor (Math.random () * 0xFFFFFF) .toString (16) .toUpperCase ()
Return "#" + "000000" .substring (0mai 6m color Str) + colorStr
}
/ * *
* convert hexadecimal colors to RGB colors
* @ param color the hexadecimal color to convert
* @ return RGB Color
, /
Function colorHexToRGB (color) {
Color=color.toUpperCase ()
Var regexpHex=/ ^ # [0-9a-fA-F] {3jie 6} $/; / Hex
If (regexpHex.test (color)) {
Var hexArray=new Array ()
Var count=1
For (var iharma i3muri) {
HexArray.push (Number ("0x" + color.substring (count,count+2)
Count+=2
} else {
HexArray.push (Number ("0x" + color.charAt (count) + color.charAt (count)
Count+=1
}
}
Return "RGB (" + hexArray.join (",") + ")"
} else {
Return color
}
}
/ * *
* convert RGB colors to hexadecimal colors
* @ param color the RGB color to convert
* @ return hex color
, /
Function colorRGBToHex (color) {
Var regexpRGB=/ ^ (rgb | RGB)\ ([0-9] {1pr 3},\ s? [0-9] {1jue 3},\ s? [0-9] {1pr 3}\) $/; / / RGB
If (regexpRGB.test (color)) {
Color=color.replace (/ (\ (|\) | rgb | RGB) * / g, ") .split (", ")
Var colorHex= "#"
For (var iTuno Bandi)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.