<commit_before>'use strict';

const ShellComponent = require('./shell-component');
const themes = require('iterm-colors/bundle.json');

module.exports = function init(app) {
  app.config.on('all-preferences-loaded', () => {
    const pref = app.packages.shell.preferences;
    pref['user-css'] = (pref['user-css'] || '').replace(/~/g, app.config.configFolder);
  });

  app.on('packages-init-done', () => {
    app.commands.execute('inject-js', `window.twemoji = require('${require.resolve('twemoji')}');`);
    app.commands.execute('inject-script', __dirname + '/hterm_all.js');
    setTimeout(()=>app.commands.execute('new-tab'), 100);
  });

  const pkg = {
    initializeTerminal(t) {

      console.log(themes)
      if (this.preferences.theme) {
        const themeName = this.preferences.theme;
        const theme = themes[themeName];
        if (theme.background) {
          t.prefs_.set('background-color', theme.background);
            
        }
        if (theme.foreground) {
          t.prefs_.set('foreground-color', theme.foreground);
        }
        if (theme.cursor_text) {
          t.prefs_.set('cursor-color', theme.cursor_text);
        }
        if (theme.palette) {
          t.prefs_.set('color-palette-overrides', theme.palette);
        }
        
      }

      delete this.preferences.theme;

      Object.keys(this.preferences).forEach(k => {<commit_msg>resolved theme bug<commit_after>'use strict';

const ShellComponent = require('./shell-component');
const themes = require('iterm-colors/bundle.json');

module.exports = function init(app) {
  app.config.on('all-preferences-loaded', () => {
    const pref = app.packages.shell.preferences;
    pref['user-css'] = (pref['user-css'] || '').replace(/~/g, app.config.configFolder);
  });

  app.on('packages-init-done', () => {
    app.commands.execute('inject-js', `window.twemoji = require('${require.resolve('twemoji')}');`);
    app.commands.execute('inject-script', __dirname + '/hterm_all.js');
    setTimeout(()=>app.commands.execute('new-tab'), 100);
  });

  const pkg = {
    initializeTerminal(t) {
      if (!this._theme) {
        this._theme = this.preferences.theme;
      }
      if (this._theme) {
        const theme = themes[this._theme];
        if (theme.background) {
          t.prefs_.set('background-color', theme.background);
        }

        if (theme.foreground) {
          t.prefs_.set('foreground-color', theme.foreground);
        }

        if (theme.cursor_text) {
          t.prefs_.set('cursor-color', theme.cursor_text);
        }

        if (theme.palette) {
          t.prefs_.set('color-palette-overrides', theme.palette);
        }
      }

      delete this.preferences.theme;

      Object.keys(this.preferences).forEach(k => {
{'fraction_non_alphanumeric': 0.17693981145757795, 'fraction_numerical': 0.002175489485134155, 'mean_word_length': 2.738482384823848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1297705', 'n_tokens_mistral': 878, 'n_tokens_neox': 862, 'n_words': 120}