Files
armorpaint/paint/sources/import_theme.ts
T

17 lines
631 B
TypeScript
Raw Normal View History

2024-03-13 23:50:11 +01:00
function import_theme_run(path: string) {
if (!path_is_json(path)) {
2025-01-19 20:35:39 +01:00
console_error(strings_unknown_asset_format());
2024-03-13 23:50:11 +01:00
return;
}
2024-03-20 16:13:54 +01:00
let filename: string = substring(path, string_last_index_of(path, path_sep) + 1, path.length);
2024-03-13 23:50:11 +01:00
let dst_path: string = path_data() + path_sep + "themes" + path_sep + filename;
2025-10-15 18:39:55 +02:00
file_copy(path, dst_path); // Copy to preset folder
2024-03-13 23:50:11 +01:00
box_preferences_fetch_themes(); // Refresh file list
2025-10-15 18:39:55 +02:00
config_raw.theme = filename;
2025-09-23 21:44:39 +02:00
box_preferences_theme_handle.i = box_preferences_get_theme_index();
2024-03-13 23:50:11 +01:00
config_load_theme(config_raw.theme);
console_info(tr("Theme imported:") + " " + filename);
}