Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

utils.ts 607B

12345678910111213
  1. /**
  2. * Creates the color tokens based on the color theme and the association map.
  3. * If a key is not found in the association map it defaults to the current value.
  4. *
  5. * @param {Object} colorMap - A map between the token name and the actual color value.
  6. * @param {Object} colors - An object containing all the theme colors.
  7. * @returns {Object}
  8. */
  9. export function createColorTokens(colorMap: Object, colors: Object): any {
  10. return Object.entries(colorMap)
  11. .reduce((result, [ token, value ]: [any, keyof Object]) =>
  12. Object.assign(result, { [token]: colors[value] || value }), {});
  13. }