function toColorComponent(s, divider) {
  return s.endsWith('%')
    ? Number(s.substring(0, s.length - 1)) / divider
    : Number(s);
}
@param {string} s Color component as number or percentage.
@param {number} divider Divider for percentage.
@return {number} Color component.