2
0
Files
bot/packages/bot-engine/src/services/theme.ts

26 lines
664 B
TypeScript
Raw Normal View History

2022-01-06 09:40:56 +01:00
import { BackgroundType, Theme } from 'models'
2021-12-23 09:37:42 +01:00
const cssVariableNames = {
container: {
bg: {
image: '--typebot-container-bg-image',
color: '--typebot-container-bg-color',
},
fontFamily: '--typebot-container-font-family',
},
}
export const setCssVariablesValue = (
theme: Theme,
documentStyle: CSSStyleDeclaration
) => {
const { background, font } = theme.general
documentStyle.setProperty(
background.type === BackgroundType.IMAGE
? cssVariableNames.container.bg.image
: cssVariableNames.container.bg.color,
background.content
)
documentStyle.setProperty(cssVariableNames.container.fontFamily, font)
}