Color Palettes

I have started using colour palettes and I have a few questions.
I have read up about them here ( and here ( but I have not really got my head around it all. I did try to do a search on the Google groups and that was not useful because too much came up and I could not find the right information. so my questions are:

How do they work? As in what is happening in layman terms. My understanding is that there is a 'layer' which is what the palette looks like, so to use the lava preset as an a example, one side is black, whilst the other side through a coloured gradient is white. We can then use code to make it move along, or do what we like, but in essence the 'layer' is what we are going to be showing. Is this correct?

Moving to the code, I have a few questions. I adapted the colour palette which was pre installed and came up with this ( It is a a rotating switch-case scenario of all the preset versions. Whilst I can get it to work, I don't truly understand what is going on in the code. what is required, and also what 'what' does.
CRGBPalette16 currentPalette; - I know it is needed, but what does it do?

TBlendType currentBlending; - same again, what is the purpose of this? As in why do we have to call TBlendType? whenlater on we call the blending to be LINEARBLEND

extern CRGBPalette16 myRedWhiteBluePalette; - I have no idea what this does

extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM; - nor any idea what this does too

startIndex = startIndex + 1;
what does this do? i know it links to the function somehow, but I cant get my head around it - would be really useful to understand this

Is there a way to write this code getting rid of all the paraphernalia. just having the bare bones basicas, or is it that all of this is needed?

what is the syntax for ColorFromPalette? I see it written in a few ways and have become confused as to how it is written?

Finally, to make ym custome palette, what is the simplest way to do that too?

I appreciate there is a lot asked here, but I am keen to understand about colour pallets as I feel they are very useful and if i know more I could use them better.

thank you in advance!

Shared publicly