Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Script to generate color swatch variants?

Return to Member Forum

  • Author
    Posts
    • #62324
      Lala Lala
      Participant

      Here's what I'm looking to do:

      Take a simple box filled with a solid color (either a predefined swatch or custom color, don't care). ID then generates variants of it, similar to photoshop's image –> adjust –> variations… one swatch with, say, 10% more red, another with more green, another with more blue, another with more cyan, etc. etc.

      It'd be REALLY cool if I could tell it what variations I'm looking for, like… show me 10 variations where each one has 2% more red than the one before it… something like that.

      Does it exist, or is anyone willing to make it? Seems like it might be easy.

    • #62332

      Doesn't sound too hard (except for the fact that you really should not judge color by looking at your monitor — except when you have it calibrated, of course).

      Can you mock up an image of what the result should look like? I don't think there is much room for all the variations you list, esp. in a mere 2% increase … Or the squares could be really small, perhaps :)

    • #62337
      Lala Lala
      Participant

      Hi again – thanks for having a look.

      I wasn't actually looking to generate a whole swatch chart… just a few variations of a single color for the purposes of color matching (I have pantone swatches but they don't seem to play well with my printer, my results are way off, especially on coated paper.

      So basically, let's say I get a label I have to duplicate with a particular shade of orange, I'd make a 1″ x 1″ orange square, starting with the pantone color that looks closest on screen, then step-and-repeat to make maybe 6 or 7 squares across. These squares would gradually change in some way I specify (e.g. adding 2% more black to each one, so the first square has zero black, last one 10%).

      Then I'd print this and see which if my 6 squares came closest.

      There may be situations where one row of 6 isn't enough, I might try on row with gradually increasing black, another with gradually increasing saturation, maybe one where I up both or decrease yellow or something.

      I remember you were good with grep when I had questions about it, are you thinking this is something you can write?

    • #62338

      I'd print this and see which if my 6 squares came closest.

      That is excellent. That's exactly what I always recommend — do not trust your monitor to selectc color, print out your samples and judge from that!

      … are you thinking this is something you can write?

      Sure — an interesting little project. The hardest part was actually in the interface: to link edit text fields to their accompanying slider, and vice versa. The script is a bit too large to copy in here, you can download it straight from my site:

      https://www.jongware.com/binaries/variations.zip

      It works like this: draw a rectangle somewhere near the left side of a page and set it to your starting color. Select it, then run the script. It will display with a list of possible color changes, in %: Hue, Brightness, and Saturation (calculated in HSB space), Red, Green, and Blue (in RGB space) and Cyan, Yellow, and Magenta (in CMYK space of course). The final results are in CMYK.

      The script will draw an additional set of 5 squares, each different from the last one per your input (if possible; adding more yellow to a 100% value will show no difference). At the very end, a final rectangle gets added with the original color again, so you can judge how much the last square differs from the original color again.

      • #67837

        Theunis de Jong,
        As you can see, the name of the Indesign script above “https://www.jongware.com/binari…..ations.zip” is partially missing. I went to https://www.jongware.com/binaries/ to see if the script was there but you have many to choose from. If you please, what is the name of the zip file?

      • #67838

        Nevermind, I found it. It is called variations.zip.

      • #67839
        David Blatner
        Keymaster

        Thomas, when we moved to this new system, a lot of the URLs got messed up. I just edited and fixed the URL in Jongware’s post above. But glad you found it!

      • #67963
        Masood Ahmad
        Participant

        A good and working script. Thanks Jong for sharing it.

    • #62351
      Lala Lala
      Participant

      Hi again – just got a chance to try it! Very nice. It's too cool to see my idea suddenly become real.

      I think there's a little bug though. My first attempt, I typed a number in manually rather than using the slider and the generated colors were quite different, I think it's got something to do with the slider value being just [5] rather than [+5]. So I tried +5 on a different color, which seemed to work.

      But I think a variable isn't being reset or something, as further experiments would cause an odd second color (Which then incremented correctly). Example, a deep purple swatch I have, 96,93,31,21 … I try brightness + 2.1… 2nd swatch is 69,64,63,63, a cool dark gray. Then 3rd, 4th, 5th, etc. swatches gradually brighten as expected, but starting from that dark gray.

      Something else, but not as important, is it reaches the end of the loop and draws my original swatch as the final color.

      Anyway, if you get a minute to revisit it… I hope we can iron out whatever's happening. This tool would be tremendously useful to me.

    • #14371173
      David Blatner
      Keymaster

      I uploaded a new version here: creativepro.com/files/jongware/binaries/variations.zip

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads