{"size": 1501, "ext": "js", "max_stars_repo_path": "Modulo 1 Fundamentos/Trabalho Pratico/TrabalhoRgb 1 Modulo/js/script.js", "max_stars_repo_name": "carloseduardofernandes/bootcamp-fullstack-igti", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Modulo 1 Fundamentos/Trabalho Pratico/TrabalhoRgb 1 Modulo/js/script.js", "max_issues_repo_name": "carloseduardofernandes/bootcamp-fullstack-igti", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Modulo 1 Fundamentos/Trabalho Pratico/TrabalhoRgb 1 Modulo/js/script.js", "max_forks_repo_name": "carloseduardofernandes/bootcamp-fullstack-igti", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.0166666667, "max_line_length": 63, "alphanum_fraction": 0.7355096602}
window.addEventListener('load', start);

var inputRangeRed;
var inputTextRed;

var inputRangeGreen;
var inputTextGreen;

var inputRangeBlue;
var inputTextBlue;

function start() {
  console.log('PÁGINA ESTA CARREGADA');

  inputRangeRed = document.querySelector('#inputRangeRed');
  inputTextRed = document.querySelector('#inputTextRed');
  inputRangeRed.addEventListener('change', setColorRed);

  inputRangeGreen = document.querySelector('#inputRangeGreen');
  inputTextGreen = document.querySelector('#inputTextGreen');
  inputRangeGreen.addEventListener('change', setColorGreen);

  inputRangeBlue = document.querySelector('#inputRangeBlue');
  inputTextBlue = document.querySelector('#inputTextBlue');
  inputRangeBlue.addEventListener('change', setColorBlue);
}

function setColorRed() {
  inputTextRed.value = parseInt(inputRangeRed.value, 10);
  colorDivRgb();
  console.log('event change vermelho');
}

function setColorGreen() {
  inputTextGreen.value = parseInt(inputRangeGreen.value, 10);
  colorDivRgb();
  console.log('event change verde');
}

function setColorBlue() {
  inputTextBlue.value = parseInt(inputRangeBlue.value, 10);
  colorDivRgb();
  console.log('event change azul');
}

function colorDivRgb() {
  var divRgb = document.querySelector('#divRgbColor');
  var newColor =
    'rgb(' +
    inputTextRed.value +
    ',' +
    inputTextGreen.value +
    ',' +
    inputTextBlue.value +
    ')';

  console.log('color é:' + newColor);
  divRgb.style.backgroundColor = newColor;
}
