diff options
| author | Henry Jameson <me@hjkos.com> | 2020-02-12 00:45:37 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2020-02-12 00:46:48 +0200 |
| commit | 60446c56a5c8d4b4d669fbd4803e77ce686daac9 (patch) | |
| tree | 67f86235c42936b07b4a37a617ab971d263b5197 /src/services/style_setter/style_setter.js | |
| parent | 29133fb0084f31a9ba3c50f0d34fd6ca398d1490 (diff) | |
fix v2 breezy themes having messed up pressed buttons. updated v2.1 breezy
themes to have derived colors instead of fixed ones.
Diffstat (limited to 'src/services/style_setter/style_setter.js')
| -rw-r--r-- | src/services/style_setter/style_setter.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js index 48f51c59..c8610507 100644 --- a/src/services/style_setter/style_setter.js +++ b/src/services/style_setter/style_setter.js @@ -1,6 +1,6 @@ import { convert } from 'chromatism' import { rgb2hex, hex2rgb, rgba2css, getCssColor, relativeLuminance } from '../color_convert/color_convert.js' -import { getColors, computeDynamicColor } from '../theme_data/theme_data.service.js' +import { getColors, computeDynamicColor, getOpacitySlot } from '../theme_data/theme_data.service.js' export const applyTheme = (input) => { const { rules } = generatePreset(input) @@ -242,7 +242,7 @@ export const generateShadows = (input, colors) => { input: 'input' } const inputShadows = input.shadows && !input.themeEngineVersion - ? shadows2to3(input.shadows) + ? shadows2to3(input.shadows, input.opacity) : input.shadows || {} const shadows = Object.entries({ ...DEFAULT_SHADOWS, @@ -368,14 +368,15 @@ export const colors2to3 = (colors) => { * * Back in v2 shadows allowed you to use dynamic colors however those used pure CSS3 variables */ -export const shadows2to3 = (shadows) => { +export const shadows2to3 = (shadows, opacity) => { return Object.entries(shadows).reduce((shadowsAcc, [slotName, shadowDefs]) => { const isDynamic = ({ color }) => color.startsWith('--') + const getOpacity = ({ color }) => opacity[getOpacitySlot(color.substring(2).split(',')[0])] const newShadow = shadowDefs.reduce((shadowAcc, def) => [ ...shadowAcc, { ...def, - alpha: isDynamic(def) ? 1 : def.alpha + alpha: isDynamic(def) ? getOpacity(def) || 1 : def.alpha } ], []) return { ...shadowsAcc, [slotName]: newShadow } |
