hex to rgb function
function hex2RGB(hex){
const r = parseInt(hex.substring(1, 3), 16);
const g = parseInt(hex.substring(3, 5), 16);
const b = parseInt(hex.substring(5, 7), 16);
return `${r}, ${g}, ${b}`;
}
hex to rgb function
function hex2RGB(hex){
const r = parseInt(hex.substring(1, 3), 16);
const g = parseInt(hex.substring(3, 5), 16);
const b = parseInt(hex.substring(5, 7), 16);
return `${r}, ${g}, ${b}`;
}
rgb to hex conversion
// rgb to hex conversion
fn rgb(r: i32, g: i32, b: i32) -> String {
format!("{:02X}{:02X}{:02X}",
r as f32 as u8,
g as f32 as u8,
b as f32 as u8)
}
fn main() {
let (r, g, b) = (123, 86, 200);
println!("rgb {} {} {} to hex {} ", r, g, b, rgb(r, g, b));
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us