3
$\begingroup$

Consider a set of colors in the LAB color space.

lab = {LABColor[0.2, 0.5, 0.8], LABColor[0.6, -0.5, 0.2], 
  LABColor[0.9, 0.5, -0.8]};

And the corresponding opacities are

a={0.2,0.6,0.4};

How can I combine the colors and their corresponding opacities so that I get

laba={LABColor[0.2, 0.5, 0.8,0.2], LABColor[0.6, -0.5, 0.2,0.6], 
  LABColor[0.9, 0.5, -0.8,0.4]}
$\endgroup$
  • 2
    $\begingroup$ Look up MapThread. MapThread[Append, {lab, a}] $\endgroup$ – Szabolcs Jan 16 '18 at 16:36
6
$\begingroup$

Use

MapThread[Append, {lab, a}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.