import_gpl.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. function import_gpl(path, replace_existing) {
  2. let b = data_get_blob(path);
  3. // let swatches: TSwatchColor[] = [];
  4. // let str: string = sys_buffer_to_string(b);
  5. // let lines: string[] = string_split(str, "\\n");
  6. // // GIMP's color palette importer: https://gitlab.gnome.org/GNOME/gimp/-/blob/gimp-2-10/app/core/gimppalette-load.c#L39
  7. // if (!starts_with(lines[0], "GIMP Palette")) {
  8. // console_error(tr("Not a valid GIMP color palette"));
  9. // return;
  10. // }
  11. // let delimiter: string = ~/\s+/ig;
  12. // for (let line of lines) {
  13. // if (starts_with(line, "Name:")) continue;
  14. // else if (starts_with(line, "Columns:")) continue;
  15. // else if (starts_with(line, "#")) continue;
  16. // else {
  17. // let tokens: string[] = string_split(delimiter, line);
  18. // if (tokens.length < 3) continue;
  19. // let swatch: TSwatchColor = makeSwatch(Color.fromBytes(tokens[0], tokens[1], tokens[2]));
  20. // array_push(swatches, swatch);
  21. // }
  22. // }
  23. // if (replaceExisting) {
  24. // raw.swatches = [];
  25. // if (swatches.length == 0) { // No swatches contained
  26. // array_push(raw.swatches, makeSwatch());
  27. // }
  28. // }
  29. // if (swatches.length > 0) {
  30. // for (let s of swatches) {
  31. // array_push(raw.swatches, s);
  32. // }
  33. // }
  34. }
  35. let plugin = plugin_create();
  36. // path_swatch_importers_set("gpl", import_gpl);
  37. plugin_notify_on_delete(plugin, function() {
  38. // path_swatch_importers_delete("gpl");
  39. });