JSFiddle - React, Tailwind, and code Playground

by Alexandru Gatea

SCSS

body {
  background: rgb(228, 221, 235);
}

JavaScript

const rgbToHex = (r, g, b) => '#' + [r, g, b].map(x => {
  const hex = x.toString(16)
  return hex.length === 1 ? '0' + hex : hex
}).join('')

alert(rgbToHex(228, 221, 235));