diff options
Diffstat (limited to 'frontend/app/views/tile/handles/tile.gradient.js')
| -rw-r--r-- | frontend/app/views/tile/handles/tile.gradient.js | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/frontend/app/views/tile/handles/tile.gradient.js b/frontend/app/views/tile/handles/tile.gradient.js index 1b3cd80..0b20ace 100644 --- a/frontend/app/views/tile/handles/tile.gradient.js +++ b/frontend/app/views/tile/handles/tile.gradient.js @@ -1,5 +1,5 @@ import React from 'react' -import { generateTransform, unitsDimension } from 'app/views/tile/tile.utils' +import { generateTransform, unitsDimension, hexToRgb } from 'app/views/tile/tile.utils' export default function TileGradient({ tile, box, bounds, videoBounds, viewing, onMouseDown, onDoubleClick, onMouseEnter }) { // console.log(tile) @@ -51,19 +51,3 @@ function tileRGBA(hex, opacity) { const { r, g, b } = hexToRgb(hex) return "rgba(" + [r,g,b,opacity].join(",") + ")" } - -function hexToRgb(hex) { - let result; - if (hex.length === 7) { - result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex) - } else if (hex.length === 4) { - result = /^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(hex) - } else { - return { r: 255, g: 0, b: 255 } - } - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null -}
\ No newline at end of file |
