def change_theme(self, theme: str):
    themes_directory = self._resource_path('themes')
    theme_file = (themes_directory / f'{theme}.yaml')
    if (not theme_file.is_file()):
        raise ConfigError(f'Theme "{theme}" not found')
    theme_yaml = self._load(theme_file)
    if (theme_yaml is None):
        raise ConfigError(f'File {theme_file.name} is empty')
    if ('colors' not in theme_yaml):
        raise ConfigError(f'{theme_file} does not contain color config')
    expected_colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
    expected_props = {'primary': ['background', 'foreground'], 'normal': expected_colors, 'bright': expected_colors}
    for k in expected_props:
        if (k not in theme_yaml['colors']):
            log.warn(f'Missing "colors:{k}" for theme "{theme}"')
            continue
        for v in expected_props[k]:
            if (v not in theme_yaml['colors'][k]):
                log.warn(f'Missing "colors:{k}:{v}" for theme "{theme}"')
    self.config['colors'] = theme_yaml['colors']
    log.ok(f'Theme {theme} applied')
def change_theme(self, theme: str):
    themes_directory = self._resource_path('themes')
    theme_file = (themes_directory / f'{theme}.yaml')
    if (not theme_file.is_file()):
        raise ConfigError(f'Theme "{theme}" not found')
    theme_yaml = self._load(theme_file)
    if (theme_yaml is None):
        raise ConfigError(f'File {theme_file.name} is empty')
    if ('colors' not in theme_yaml):
        raise ConfigError(f'{theme_file} does not contain color config')
    expected_colors = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
    expected_props = {'primary': ['background', 'foreground'], 'normal': expected_colors, 'bright': expected_colors}
    for k in expected_props:
        if (k not in theme_yaml['colors']):
            log.warn(f'Missing "colors:{k}" for theme "{theme}"')
            continue
        for v in expected_props[k]:
            if (v not in theme_yaml['colors'][k]):
                log.warn(f'Missing "colors:{k}:{v}" for theme "{theme}"')
    self.config['colors'] = theme_yaml['colors']
    log.ok(f'Theme {theme} applied')