diff options
| author | Henry Jameson <me@hjkos.com> | 2018-11-21 04:26:45 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2018-11-21 04:26:45 +0300 |
| commit | 50562eb6b700cee84f70210fd1adc8df3b18b92b (patch) | |
| tree | 2d2674fd891537e04fce0777a0d9f1b55b571a68 | |
| parent | 3d6547001ecf9ae5e923d399dfe2c80b920beecf (diff) | |
fix lint, for shadows, it's now possible to refer css variables as colors
| -rw-r--r-- | src/components/user_card_content/user_card_content.js | 1 | ||||
| -rw-r--r-- | src/services/style_setter/style_setter.js | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/components/user_card_content/user_card_content.js b/src/components/user_card_content/user_card_content.js index 4c7b6a68..e8073021 100644 --- a/src/components/user_card_content/user_card_content.js +++ b/src/components/user_card_content/user_card_content.js @@ -1,5 +1,4 @@ import StillImage from '../still-image/still-image.vue' -import { hex2rgb } from '../../services/color_convert/color_convert.js' export default { props: [ 'user', 'switcher', 'selected', 'hideBio' ], diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 45e950f0..1b7ec7f2 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -101,11 +101,29 @@ const getCssShadow = (input) => { shad.blur, shad.spread ].map(_ => _ + 'px').concat([ - rgb2rgba({...(hex2rgb(shad.color)), a: shad.alpha}), + getCssColor(shad.color, shad.alpha), shad.inset ? 'inset' : '' ]).join(' ')).join(', ') } +const getCssColor = (input, a) => { + console.log(input) + let rgb = {} + if (typeof input === 'object') { + rgb = input + } else if (typeof input === 'string') { + if (input.startsWith('#')) { + rgb = hex2rgb(input) + } else if (input.startsWith('--')) { + return `var(${input})` + } else { + return input + } + } + console.log(rgb2rgba({ ...rgb, a })) + return rgb2rgba({ ...rgb, a }) +} + const generateColors = (input) => { const colors = {} const opacity = Object.assign({ |
