Merge pull request #1619 from 30-seconds/rgb-naming

cleaner names inside toRGBObject
This commit is contained in:
Angelos Chalaris
2020-10-17 20:18:59 +03:00
committed by GitHub

View File

@ -11,11 +11,11 @@ Converts an `rgb()` color string to an object with the values of each color.
```js
const toRGBObject = rgbStr => {
const [r, g, b] = rgbStr.match(/\d+/g).map(Number);
return { r, g, b };
const [red, green, blue] = rgbStr.match(/\d+/g).map(Number);
return { red, green, blue };
};
```
```js
toRGBObject('rgb(255,12,0)'); // {r: 255, g: 12, b: 0}
toRGBObject("rgb(255,12,0)"); // {red: 255, green: 12, blue: 0}
```