Fully renamed and updated everything, tagged, built

This commit is contained in:
Angelos Chalaris
2017-12-17 17:55:51 +02:00
parent c209d9e972
commit 9db5e43e66
108 changed files with 1317 additions and 914 deletions

13
snippets/hexToRGB.md Normal file
View File

@@ -0,0 +1,13 @@
### hexToRGB
Converts a colorcode to a `rgb()` string.
Use bitwise right-shift operator and mask bits with `&` (and) operator to convert a hexadecimal color code (prefixed with `#`) to a string with the RGB values.
```js
const hexToRGB = hex => {
const h = parseInt(hex.slice(1), 16);
return `rgb(${h >> 16}, ${(h & 0x00ff00) >> 8}, ${h & 0x0000ff})`;
}
// hexToRgb('#27ae60') -> 'rgb(39, 174, 96)'
```