Change color

Example

preview.forEach(view => {
  const input = view.previousElementSibling;
  const value = input.value;
  const id = input.id;
  const spanClass = document.querySelectorAll(`.${id}`);

  view.style.paddingLeft = 20;
  
  spanClass.forEach(span => {
    span.style.color = input.value;
  });
});