1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-06 05:55:28 +00:00
bramw_baserow/web-frontend/modules/builder/components/theme/ThemeProvider.vue

32 lines
772 B
Vue

<template>
<div :style="style">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'ThemeProvider',
inject: ['builder'],
computed: {
style() {
const colors = {
'--primary-color': this.builder.theme.primary_color,
'--secondary-color': this.builder.theme.secondary_color,
}
const headings = Array.from([1, 2, 3, 4, 5, 6]).reduce(
(headings, level) => ({
[`--heading-h${level}--font-size`]: `${
this.builder.theme[`heading_${level}_font_size`]
}px`,
[`--heading-h${level}--color`]:
this.builder.theme[`heading_${level}_color`],
...headings,
}),
{}
)
return { ...colors, ...headings }
},
},
}
</script>