您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

utils.js 599B

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