📌  相关文章
📜  将十六进制代码转换为 rgb javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:34.401000             🧑  作者: Mango

代码示例3
function componentToHex(c) {
  var hex = c.toString(16);
  return hex.length == 1 ? "0" + hex : hex;
}

function rgbToHex(r, g, b) {
  return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
}

alert(rgbToHex(0, 51, 255)); // #0033ff