Skip to main content
Participating Frequently
Sep 5, 2024 4:46 PM UTC
Question

Create named swatch library outside of illustrator

I'm not even sure of the correct terminology here so I haven't been having much luck searching google or the forums.

 

This is what I'm after:

I have a list of color names and their accompanying cmyk values on my computer

I want to create a swatch library that I can open in Illustrator and that will display the color name when I hover over each swatch

I want to do this without entering individually each name and value inside Illustrator

 

I have a list with entries that look like this:

Corinthian Pink
0, 35, 15, 0

 

Is there some tool that can convert such a list (or let me quickly copy and paste)?

 

 

This topic is closed to new replies. Start a new post to keep the conversation going.

6 replies

Participating Frequently
Sep 6, 2024 2:52 PM UTC

Posting this here for anyone who, like me, wants Sanzo Wada's colors from A Dictionary of Color Combinations, using the CMYK values listed in the book (Seigensha edition published 2024). 

 

Google Drive link to the .ase file 

Translate
renél80416020
Inspiring
Sep 6, 2024 10:08 AM UTC

Bonjour,

/*Utilisation du script :
1 Ouvrir ou créer un fichier (.ai) Mode de colorimétrie RVG ou CMJN,
2 importer le fichier texte .csv, et placer le caractère @
au début de la première ligne, Corinthien,0,35,15,0, si le texte est captif pas besion d'ajuster,
le contenu est dans la mémoire.
3 lancer le script,
Remarque: Si pas de texte le tableau mapObjt est pris en compte.
*/

 

// JavaScript Document for Illustrator
//paletteCouleurCMJN_01.js
// Landry René - elleere Fri, 23 March 2018 10:16:41 GMT
//------------------------------------------------------
/*Utilisation du script :
1 Ouvrir ou créer un fichier (.ai) Mode de colorimétrie RVG ou CMJN,
2 importer le fichier texte .csv, et placer le caractère @
  au début de la première ligne,  Corinthien,0,35,15,0, si le texte est captif pas besion d'ajuster,
  le contenu est dans la mémoire.
3 lancer le script,
Remarque: Si pas de texte le tableau mapObjt est pris en compte.
*/
//-----------------------------------------------------------
var indice = "@"; // indice pour indentifier le bon texte
var sep1 = "\r";  // saut ligne
var sep2 = ",";   // séparateur (non <- couleur CMJN))
var Grpname = "Ral_Perso"; // nom du groupe de nuances
var mapObjt = [["Rose Corinthien",0, 35, 15, 0],["Vert pomme",100,12,50,10]];
//-------------
  var docRef = activeDocument;
  var ok = false;
    if (docRef.textFrames.length) {
      for (var t = 0; t < docRef.textFrames.length; t++) {
        var text = docRef.textFrames[t];
          if (text.contents.charAt(0) == indice) {
          ok = true;
          break;
          }
      }
    }
    if (ok) mapObjt = initTab(text,indice,sep1,sep2)
    var grp = docRef.swatchGroups.add();
        grp.name = Grpname;

    for (var i = 0; i < mapObjt.length; i++) {
       couleur = macmykColor(mapObjt[i]);
       sw =docRef.swatches.add();
       sw.color = couleur;
       sw.name = mapObjt[i][0];
       grp.addSwatch(sw);
    }
//--------
function initTab(text,indice,s1,s2) {
// Initialisation d'un tableau à 2 dimensions
  var textContent = text.contents;
      textContent = textContent.substring(1);
  var tab = textContent.split(s1);
          for (var i = 0; i < tab.length; i++) {
            tab[i] =  tab[i].split(s2);
          }
  return tab;
}
//--------
function macmykColor(c)
{ //cree une nouvelle couleur CMJN
  var cmykColor = new CMYKColor();
    with (cmykColor) {cyan = c[1]*1; magenta = c[2]*1; yellow  = c[3]*1; black = c[4]*1;}
  return cmykColor;
}
//--------

 

Exemple de texte correspondant au tableau mapObjt

 

 

 

Translate
Participating Frequently
Sep 6, 2024 2:08 PM UTC

Thanks both of you, I was able to find additional info after some more searching here in the community. My primary issue now is that I don't really understand how scripts work or how to get them to run in AI. I copied a script, placed it in textedit (i'm on mac), and then changed the file extension to .jsx. When I tried to open this in AI, though, the file was grey and unable to be opened. What am I doing wrong? 

Translate
Larry G. Schneider
Community Expert
Community Expert
Sep 6, 2024 2:19 PM UTC

Make sure when you save the file from TextEdit that you force it to be plain text. The default from TE is Rich Text which will not work.

Translate
Ton Frederiks
Community Expert
Community Expert
Sep 5, 2024 6:25 PM UTC