Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
jitsi-meet/react/features/base/ui/utils.ts

42 lines
1.4 KiB

import { merge } from 'lodash-es';
import * as jitsiTokens from './jitsiTokens.json';
import * as tokens from './tokens.json';
/**
* Creates the color tokens based on the color theme and the association map.
*
* @param {Object} colorMap - A map between the token name and the actual color value.
* @returns {Object}
*/
export function createColorTokens(colorMap: Object): any {
const allTokens = merge({}, tokens, jitsiTokens);
return Object.entries(colorMap)
.reduce((result, [ token, value ]: [any, string]) => {
const color = allTokens[value as keyof typeof allTokens] || value;
return Object.assign(result, { [token]: color });
}, {});
}
/**
* Create the typography tokens based on the typography theme and the association map.
*
* @param {Object} typography - A map between the token name and the actual typography value.
* @returns {Object}
*/
export function createTypographyTokens(typography: Object): any {
const allTokens = merge({}, tokens, jitsiTokens);
return Object.entries(typography)
.reduce((result, [ token, value ]: [any, any]) => {
let typographyValue = value;
if (typeof value === 'string') {
typographyValue = allTokens[value as keyof typeof allTokens] || value;
}
return Object.assign(result, { [token]: typographyValue });
}, {});
}