3 Replies Latest reply on Apr 20, 2011 2:17 AM by Emanuele Radaelli

    [JS CS5] Deleting unused colours

    Emanuele Radaelli Level 1


      I have a document with over 3000 colours.

      Most of them are unused, a few are swatches.

      I thought to add all unnamed colours to swatches and then to delete all colours without a name but I do not know how to do the first step.

      Unfortunately I have a "document.unusedSwatches" but not a "document.unusedColours".

      Is there any other way to know if a colour is used or not within a document?



        • 1. Re: [JS CS5] Deleting unused colours
          [Jongware] Most Valuable Participant

          You lost me about halfway in ... How can you have "3000 colors" of which only some are swatches? If you have those 3000 colors in your document, they may or may pop up in your swatches panel, but all of them are used. Per definition.


          (Removing unused swatches, on the other hand, is simple. You can do it manually -- in the Swatches panel menu --, or semi-manually, using the Unused Swatches list in the active document, or just be blunt and invoke the swatches panel menu item to remove unused swatches.)

          • 2. Re: [JS CS5] Deleting unused colours
            Emanuele Radaelli Level 1

            Working with colors I found that everytime you create a color (with the color panel) InDesign instance a color object with no name, even if you are applying it directly to an object. The same happens if you play with color sliders: everytime you change something form the color palette a new color object is created. Weird I know, but that's how InDesign works. Try it yourself: create a new document, open the color panel and randomly change color values playing with color palette sliders: if you count colors objects (app.activeDocument.colors.length) you'll see that the amount of colors increase everytime you change something in color palette. Colors are basically a swatch subclass, and the only thing that matter is the fact they don't have a name. So you can have colors (with no name) that are not swatches but are correctly applied to objects. When you select "add unnamed colors" (I'm translating it from italian...) from swatches palette you basically give a name to applied colors and transform them in swatches.

            Here comes my problem: I need to add used "colors" in swatches palette in order to make them become "swatches" and then delete all unused "colors" because I need to get rid of all unused colors, not only swatches.

            I can manually add unnamed colors to the swatch palette, but it looks like it's not that simple by script.

            Sorry for my english, hope evreything was clear enough.