src/utils/themes.js
/**
 * Walks an object recursively, concating it's keys together until it reaches the end
 * @param {String} parentKey - the parent's current item key
 * @param {*} parentValue - the parent's current item value
 * @param {Object} accumulated - the object that holds the end result
 * @param {String} colorScheme - the current color scheme
 */
Walks an object recursively, concating it's keys together until it reaches the end
@param {String} parentKey - the parent's current item key
@param {*} parentValue - the parent's current item value
@param {Object} accumulated - the object that holds the end result
@param {String} colorScheme - the current color scheme
Walks an object recursively concating it ' s keys together until it reaches the end @param { String } parentKey - the parent ' s current item key @param { * } parentValue - the parent ' s current item value @param { Object } accumulated - the object that holds the end result @param { String } colorScheme - the current color scheme
function walkThemeObject(parentKey, parentValue, accumulated, colorScheme) {
  if (
    parentValue
    && typeof parentValue === 'object'
    && !(colorScheme && (hasSchemeColor(parentValue, 'light') || hasSchemeColor(parentValue, 'dark')))
  ) {
    Object.entries(parentValue).forEach(([key, value]) => {
      const currentKey = [parentKey, key].join('-');
      walkThemeObject(currentKey, value, accumulated, colorScheme);
    });
  } else {
    let value = parentValue;
    if (hasSchemeColor(parentValue, colorScheme)) value = parentValue[colorScheme];
    if (typeof value === 'object') return;
    accumulated[parentKey] = value;
  }
}
function walkThemeObject ( parentKey , parentValue , accumulated , colorScheme ) { if ( parentValue && typeof parentValue === 'object' && ! ( colorScheme && ( hasSchemeColor ( parentValue , 'light' ) || hasSchemeColor ( parentValue , 'dark' ) ) ) ) { Object . entries ( parentValue ) . forEach ( ( [ key , value ] ) => { const currentKey = [ parentKey , key ] . join ( '-' ) ; walkThemeObject ( currentKey , value , accumulated , colorScheme ) ; } ) ; } else { let value = parentValue ; if ( hasSchemeColor ( parentValue , colorScheme ) ) value = parentValue [ colorScheme ] ; if ( typeof value === 'object' ) return ; accumulated [ parentKey ] = value ; } }
Walks an object recursively, concating it's keys together until it reaches the end
 @param {String} parentKey - the parent's current item key
 @param {*} parentValue - the parent's current item value
 @param {Object} accumulated - the object that holds the end result
 @param {String} colorScheme - the current color scheme
Walks an object recursively concating it ' s keys together until it reaches the end @param { String } parentKey - the parent ' s current item key @param { * } parentValue - the parent ' s current item value @param { Object } accumulated - the object that holds the end result @param { String } colorScheme - the current color scheme
// if `value` is still an object, its probably the wrong color for the current color scheme. // eslint-disable-next-line no-param-reassign