<commit_before><commit_msg>Create scripts.jsx<commit_after>class HexToRgb extends React.Component {

  constructor(props, context) {
    super(props, context);
    
    this.state = {
      theR: '',
      theG: '',
      theB: '',
      theHex: '',
      bgColor: ''
    }
    
    this.convertHex = this.convertHex.bind(this);
  }

  convertHex(e) {
    var hex = e.target.value;

    this.setState({
      theHex: hex
    });
    
    var pass = false;
    if (hex.length === 3) {
      var hex = hex.substring(0, 1) + hex.substring(0, 1) + hex.substring(1, 2) + hex.substring(1, 2) + hex.substring(2, 3) + hex.substring(2, 3);
      pass = true;
    } else if (hex.length === 6) {
      pass = true
    } else {
      pass = false
    }

    if (pass) {

      var bigint = parseInt(hex, 16);
      var r = (bigint >> 16) & 255;
      var g = (bigint >> 8) & 255;
      var b = bigint & 255;

      this.setState({
        theR: r,
        theG: g,
        theB: b,
        bgColor: '#' + hex
      });

    } else {
      this.setState({
        theR: '',
        theG: '',
        theB: '',
        bgColor: '#34495e'
      });

    }
  }

  render() {
    document.body.style.backgroundColor = this.state.bgColor;

    const mBottom = {
      marginBottom: '20px'
    };

    const mRight = {
      marginRight: '20px'
    }

    return (

      <center>
      <input type="text" style={mBottom} className="textBox1" onChange={this.convertHex} placeholder='HEX' maxLength={6} autoFocus={focus} value={this.state.theHex}/><br/>
      <input type="text" style={mRight} className="textBox2" placeholder='R' readonly value={this.state.theR}/> 
      <input type="text" style={mRight} className="textBox2" placeholder='G' readonly value={this.state.theG}/> 
      <input type="text" className="textBox2" placeholder='B' readonly value={this.state.theB}/>
      </center>

    );
  }
};

ReactDOM.render(
  < HexToRgb / >
  , document.getElementById('container')
);
{'fraction_non_alphanumeric': 0.16378433367243134, 'fraction_numerical': 0.021363173957273652, 'mean_word_length': 2.245874587458746, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1957678', 'n_tokens_mistral': 709, 'n_tokens_neox': 668, 'n_words': 137}