LED Strip to Display Different Color Based on MIDI Note

I have a working code in which the LED strip responds to MIDI messages from a keyboard, but only displays one color.

How could this code be adjusted to have each pixel display a different color based on the MIDI note received, such as the Keyboard image shows (blue on left of strip moving along the color wheel to green on right)

inline void handleGateChanged(bool inGateActive)
{
    digitalWrite(LED_BUILTIN, inGateActive ? LOW : HIGH);
}

inline void pulseGate()
{
    handleGateChanged(false);
    delay(10);
    handleGateChanged(true);
}

// -----------------------------------------------------------------------------

byte noteToStripIndex(byte pitch)
{
    byte index;
    if(pitch < KEYBOARD_LOWEST_NOTE)
      index = 0;
    else if(pitch > KEYBOARD_HIGHEST_NOTE)
      index = NUMPIXELS -1;
    else
      index = (NUMPIXELS -1) * (pitch - KEYBOARD_LOWEST_NOTE) / (KEYBOARD_HIGHEST_NOTE - KEYBOARD_LOWEST_NOTE);
    if(STRIP_REVERSED)
      index = (NUMPIXELS -1) - index;

    return index;
}

void handleNotesChanged(bool isFirstNote = true)
{
    if (midiNotes.empty())
    {
        strip.clear();
        strip.show();
        handleGateChanged(true);
    }
    else
    {
        byte pitch = 0;
        strip.clear();
        for (byte i = 0; i < midiNotes.size(); ++i)
        {
            if(midiNotes.get(i, pitch))
            {
                [b]strip.setPixelColor(noteToStripIndex(pitch), 255,255,0);[/b] //follows GRB 
                
            }
        }
        strip.show();

        
        }
  }

// -----------------------------------------------------------------------------

void handleNoteOn(byte inChannel, byte inNote, byte inVelocity) 
{
    const bool firstNote = midiNotes.empty();
    midiNotes.add(MidiNote(inNote, inVelocity));
    //digitalWrite(LED_BUILTIN, LOW);
    handleNotesChanged(firstNote);
}

void handleNoteOff(byte inChannel, byte inNote, byte inVelocity)
{
    midiNotes.remove(inNote);
    //digitalWrite(LED_BUILTIN, HIGH);
    handleNotesChanged();
}

// -----------------------------------------------------------------------------

void setup()
{
    pinMode(LED_BUILTIN, OUTPUT);
    MIDI.setHandleNoteOn(handleNoteOn);
    MIDI.setHandleNoteOff(handleNoteOff);
    MIDI.begin(MIDI_CHANNEL_OMNI);
    //Serial.begin(115200);//For debug only
    digitalWrite(LED_BUILTIN, HIGH);

    strip.begin();
    //strip.show(); // Initialize all pixels to 'off'
    strip.clear();
    strip.show();
}

void loop()
{
    MIDI.read();

I'm very new to programming! Any help would be greatly appreciated.

Using Adafruit DotStar LED and Arduino UNO with MIDI input

How could this code be adjusted to have each pixel display a different color based on the MIDI note received

I'm not sure I understand the question. The pictures appears to show different colors for different pixels, but which pixels are lit is not defined, nor are the notes that were received, nor is the number of notes received.

When you can define what should happen - which pixels are to be which color - for each note, the code will be trivial to implement.

for (byte i = 0; i < midiNotes.size(); ++i)
        {
            if(midiNotes.get(i, pitch))
            {
                [b]strip.setPixelColor(noteToStripIndex(pitch), 255,255,0);[/b] //follows GRB 
                
            }
        }

don't use the 'Bold'-tag within the code we may get confused, also your include and object declaration are missing, but from the command used i gather you use adafruit_neopixel.h, in the command .setPixelColor, the first parameter is the pixel nr. and the other 3 are the RGB values for the color. What you could do is declare an Array of colors const uint32_t colors[] = {0xFF0000, 0x00FF00, 0x0000FF, ..etc}
and use the overloaded version strip.setPixelColor(noteToStripIndex(pitch), colors [noteToStripIndex(pitch) ] ); like this you can define the exact color you want for each pixel. (make sure you have all colors defined) Or you could do some calculation from the pixelnr converting it into a color.