user82090: I want to address the first and last three pixels of a 9 pixel strip and apply a gradient to them using FastLED.  I can successfully address them but the colors displayed are not correct.  Is there something I'm overlooking or misunderstand about the way FastLED works?
#include <FastLED.h>

// the whole strip
#define NUM_LEDS 9

#define LED_PIN 6

CRGB leds[NUM_LEDS];

// Define the indexes of the first and last 3 indexes of a 9 pixel strip
int customLeds[6] = {0,1,2,6,7,8};

// My Palette
DEFINE_GRADIENT_PALETTE (heatmap) {
  0, 255, 0, 0,      // Red
  128, 0, 255, 0,    // Green
  255, 0, 0, 255     // Blue
};

CRGBPalette16 myPalette1 = heatmap;

void setup() {
  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(20);
}

void loop() {
  
  for (int i = 0; i < (sizeof(customLeds)); i++) {
   // Each i led get the correct color given their place in the array  - 0, 42.5, 85, 127.5, 170, 212.5, 255
    leds[customLeds[i]] = ColorFromPalette(myPalette1, (i * (255 / sizeof(customLeds))), 255, LINEARBLEND); 
  }
  
  FastLED.show();

}


user82090: So here is the answer I came up with:
#include <FastLED.h>

// the whole strip
#define NUM_LEDS 9

#define LED_PIN 6

CRGB leds[NUM_LEDS];

// Define the indexes of the first and last 3 indexes of a 9 pixel strip
bool customLeds[9] = {1, 1, 1, 0, 0, 0, 1, 1, 1};
int customLeds_num = 6;


// My Palette
DEFINE_GRADIENT_PALETTE (heatmap) {
  0, 255, 0, 0,      // Red
  128, 0, 255, 0,    // Green
  255, 0, 0, 255     // Blue
};

CRGBPalette16 myPalette1 = heatmap;


void setup() {
  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(5);

}

void loop() {

  FastLED.clear();

  //  Keep track of how many leds have been lit
  int customLedIndex1 = 0;
  

  for (int i = 0; i < NUM_LEDS; i++) {
    // Each i led get the correct color given their place in the array  - 0, 42.5, 85, 127.5, 170, 212.5, 255

    //lights a specific pixel only if it's in the customLeds truth table
    if (customLeds[i]) {
      // works out where on the gradient a specific pixel is
      leds[i] = ColorFromPalette(myPalette1, (customLedIndex1 * (255 / 5)), 255, LINEARBLEND);

      //increments the index for the next pixels value on the gradient
      customLedIndex1++;

    }

  }

  FastLED.show();
  
  customLedIndex1 = 0;

}

The solution involved using a boolean array that indicates which leds needed to be on (true / 1) and which off (false / 0) and then create a separate index (customLedIndex) which counted how many of the leds where lit so they could receive the correct color corresponding to their 'place' in the palette

82090: <p>I want to address the first and last three pixels of a 9 pixel strip and apply a gradient to them using FastLED.  I can successfully address them but the colors displayed are not correct.  Is there something I'm overlooking or misunderstand about the way FastLED works?</p>
<pre><code>#include &lt;FastLED.h&gt;

// the whole strip
#define NUM_LEDS 9

#define LED_PIN 6

CRGB leds[NUM_LEDS];

// Define the indexes of the first and last 3 indexes of a 9 pixel strip
int customLeds[6] = {0,1,2,6,7,8};

// My Palette
DEFINE_GRADIENT_PALETTE (heatmap) {
  0, 255, 0, 0,      // Red
  128, 0, 255, 0,    // Green
  255, 0, 0, 255     // Blue
};

CRGBPalette16 myPalette1 = heatmap;

void setup() {
  FastLED.addLeds&lt;WS2812B, LED_PIN, GRB&gt;(leds, NUM_LEDS);
  FastLED.setBrightness(20);
}

void loop() {
  
  for (int i = 0; i &lt; (sizeof(customLeds)); i++) {
   // Each i led get the correct color given their place in the array  - 0, 42.5, 85, 127.5, 170, 212.5, 255
    leds[customLeds[i]] = ColorFromPalette(myPalette1, (i * (255 / sizeof(customLeds))), 255, LINEARBLEND); 
  }
  
  FastLED.show();

}
</code></pre>
 82090: <p>So here is the answer I came up with:</p>
<pre><code>#include &lt;FastLED.h&gt;

// the whole strip
#define NUM_LEDS 9

#define LED_PIN 6

CRGB leds[NUM_LEDS];

// Define the indexes of the first and last 3 indexes of a 9 pixel strip
bool customLeds[9] = {1, 1, 1, 0, 0, 0, 1, 1, 1};
int customLeds_num = 6;


// My Palette
DEFINE_GRADIENT_PALETTE (heatmap) {
  0, 255, 0, 0,      // Red
  128, 0, 255, 0,    // Green
  255, 0, 0, 255     // Blue
};

CRGBPalette16 myPalette1 = heatmap;


void setup() {
  FastLED.addLeds&lt;WS2812B, LED_PIN, GRB&gt;(leds, NUM_LEDS);
  FastLED.setBrightness(5);

}

void loop() {

  FastLED.clear();

  //  Keep track of how many leds have been lit
  int customLedIndex1 = 0;
  

  for (int i = 0; i &lt; NUM_LEDS; i++) {
    // Each i led get the correct color given their place in the array  - 0, 42.5, 85, 127.5, 170, 212.5, 255

    //lights a specific pixel only if it's in the customLeds truth table
    if (customLeds[i]) {
      // works out where on the gradient a specific pixel is
      leds[i] = ColorFromPalette(myPalette1, (customLedIndex1 * (255 / 5)), 255, LINEARBLEND);

      //increments the index for the next pixels value on the gradient
      customLedIndex1++;

    }

  }

  FastLED.show();
  
  customLedIndex1 = 0;

}
</code></pre>
<p>The solution involved using a boolean array that indicates which leds needed to be on (true / 1) and which off (false / 0) and then create a separate index (customLedIndex) which counted how many of the leds where lit so they could receive the correct color corresponding to their 'place' in the palette</p>
