src/utils/colors.js
function decomposeColor(color) {
  if (color.charAt(0) === '#') return decomposeColor(convertHexToRGB(color))

  color = color.replace(/\s/g, '')
  const marker = color.indexOf('(')
  if (marker === -1)
    throw new Error(`Rambler UI: The ${color} color was not parsed correctly,
      because it has an unsupported format (color name or RGB %). This may cause issues in component rendering.`)

  const type = color.substring(0, marker)
  let values = color.substring(marker + 1, color.length - 1).split(',')
  values = values.map(value => parseFloat(value))

  return {type, values}
}
function decomposeColor(color) {
  if (color.charAt(0) === '#') return decomposeColor(convertHexToRGB(color))

  color = color.replace(/\s/g, '')
  const marker = color.indexOf('(')
  if (marker === -1)
    throw new Error(`Rambler UI: The ${color} color was not parsed correctly,
      because it has an unsupported format (color name or RGB %). This may cause issues in component rendering.`)

  const type = color.substring(0, marker)
  let values = color.substring(marker + 1, color.length - 1).split(',')
  values = values.map(value => parseFloat(value))

  return {type, values}
}
function decomposeColor ( color ) { if ( color . charAt ( 0 ) === '#' ) return decomposeColor ( convertHexToRGB ( color ) ) color = color . replace ( / \s / g , '' ) const marker = color . indexOf ( '(' ) if ( marker === - 1 ) throw new Error ( ` ${ color } ` ) const type = color . substring ( 0 , marker ) let values = color . substring ( marker + 1 , color . length - 1 ) . split ( ',' ) values = values . map ( value => parseFloat ( value ) ) return { type , values } }
Returns an object with the type and values of a color.

Note: Does not support rgb % values and color names.

@param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
@returns {{type: string, values: number[]}} A MUI color object
Returns an object with the type and values of a color .