json-theme-even-fork/utils/colors.js

17 lines
557 B
JavaScript
Raw Normal View History

/** @typedef {Record<string, [light: string, dark?: string]>} ThemeColorOptions */
/** @typedef {{ colors?: ThemeColorOptions }} ThemeOptions */
/**
* @param {import('../schema.d.ts').ResumeSchema['meta'] & { themeOptions?: ThemeOptions }} meta
* @returns {string | undefined}
*/
2023-09-04 02:29:45 +02:00
export default function colors(meta = {}) {
const colors = meta.themeOptions?.colors
return (
colors &&
Object.entries(colors)
.map(([name, [light, dark = light]]) => `--color-${name}-light:${light}; --color-${name}-dark:${dark};`)
.join(' ')
)
2023-09-04 02:29:45 +02:00
}