“CSS -Farbton -Hex zu RGB a” Code-Antworten

CSS -Hex zu RGB

hexToRGB(hex, alpha) {

  const r = parseInt(hex.slice(1, 3), 16);
  const g = parseInt(hex.slice(3, 5), 16);
  const b = parseInt(hex.slice(5, 7), 16);

  if (alpha) {
    return `rgba(${r}, ${g}, ${b}, ${alpha})`;
  } else {
    return `rgb(${r}, ${g}, ${b})`;
  }
}
Yasin

CSS -Farbton -Hex zu RGB a

hexToRGB(hex, alpha) {

  const r = parseInt(hex.slice(1, 3), 16);
  const g = parseInt(hex.slice(3, 5), 16);
  const b = parseInt(hex.slice(5, 7), 16);

  if (alpha) {
    return `rgba(${r}, ${g}, ${b}, ${alpha})`;
  } else {
    return `rgb(${r}, ${g}, ${b})`;
  }
}
It's Draqula

Ähnliche Antworten wie “CSS -Farbton -Hex zu RGB a”

Fragen ähnlich wie “CSS -Farbton -Hex zu RGB a”

Weitere verwandte Antworten zu “CSS -Farbton -Hex zu RGB a” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen