RGB LED color with button

Hey, so i have a RGB LED and a button, I want the to have the led change color from a list of colors when the button is press, and I want it to fade throught all the colors when the button is hold for more than 0.5 seconds.
I'm using a arduino nano V3 https://www.amazon.es/gp/product/B01LWSJBTD/ref=ox_sc_act_title_1?smid=A1X7QLRQH87QA3&th=1

Welcome, @CubeBox391. It looks like you might have read
How to get the best out of this forum, but if not please take a moment.
As for your immediate question, I have to ask, what have you tried so far? Have you tried any tutorials?

well, i'm making these Complete Minecraft Ore Lamp by mrspiffy - Thingiverse but it uses a led with 3 pins and i have a 4 pin rgb led

Sounds like that project uses neopixel LEDs. Your led is a "dumb" RGB led. As long as it is only one led, the code can be adapted.

Ok. Three leads is either bicolor(red/green/(yellow only if you drive both), or as Paul said, Neopixel. 4-pin RGB means you have three leads, one for each color and one for + or -. Do you know which? It matters. Did it come with documentation, and if so is it called common cathode or common anode?

it has a +

Then you wire that to +5, and the three other leads to three digital outputs, each with a series resistor. Then, your code needs to set any of those outputs low to energize the colour it's attached to.

Post the code from the project in your next post. Use code tags! We can advise how to use it with a common anode RGB led and Nano V3.

How much does the resistor have to be?
These is the current code

#include <Adafruit_NeoPixel.h>

#define BUTTON_PIN   2
#define PIXEL_PIN    9  // Use pull-up resistor
#define PIXEL_COUNT  6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

volatile byte state = HIGH;
int showType = 0;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(BUTTON_PIN),changeState ,FALLING);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

}

void loop() {
  if (state == LOW) {
      showType++;
      if (showType > 5)
        showType=0;
     startShow(showType); 
   }

state = HIGH;
}

void changeState(){
  state = !state;
}

void startShow(int i) {
  switch(i){
    case 0: colorWipe(strip.Color(0, 0, 0), 10);    // Black/off
            break;
    case 1: colorWipe(strip.Color(255, 0, 0), 10);  // Redstone
            break;
    case 2: colorWipe(strip.Color(0, 255, 0), 10);  // Emerald
            break;
    case 3: colorWipe(strip.Color(0, 0, 255), 10);  // Lapis Lazuli
            break;
    case 4: colorWipe(strip.Color(255, 100, 0), 10);  // Gold
            break;
    case 5: colorWipe(strip.Color(100, 245, 228), 10);  // Diamond
            break;  
            
  }
}


// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

Currently i'm testing it on thinkercad Login | Tinkercad

How much does the resistor have to be? These is the current code.

#include <Adafruit_NeoPixel.h>

#define BUTTON_PIN   2
#define PIXEL_PIN    9  // Use pull-up resistor
#define PIXEL_COUNT  6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);

volatile byte state = HIGH;
int showType = 0;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(BUTTON_PIN),changeState ,FALLING);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'

}

void loop() {
  if (state == LOW) {
      showType++;
      if (showType > 5)
        showType=0;
     startShow(showType); 
   }

state = HIGH;
}

void changeState(){
  state = !state;
}

void startShow(int i) {
  switch(i){
    case 0: colorWipe(strip.Color(0, 0, 0), 10);    // Black/off
            break;
    case 1: colorWipe(strip.Color(255, 0, 0), 10);  // Redstone
            break;
    case 2: colorWipe(strip.Color(0, 255, 0), 10);  // Emerald
            break;
    case 3: colorWipe(strip.Color(0, 0, 255), 10);  // Lapis Lazuli
            break;
    case 4: colorWipe(strip.Color(255, 100, 0), 10);  // Gold
            break;
    case 5: colorWipe(strip.Color(100, 245, 228), 10);  // Diamond
            break;  
            
  }
}


// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}

I am currently testing it on thinkercad. https://www.tinkercad.com/things/algXOmldKaF-grand-bigery-gaaris/editel?sharecode=s9X3pYBG-7sUxVkt-nAzjgCt_JG-TNd9fI4tUtSrqxw

You will need 3 resistors. 100R for green, 100R for blue and 180R for red would be ideal.

#define BUTTON_PIN   2
#define RED_PIXEL_PIN    9 
#define GRN_PIXEL_PIN    10
#define BLU_PIXEL_PIN    11

volatile byte state = HIGH;
int showType = 0;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(BUTTON_PIN),changeState ,FALLING);

}

void loop() {
  if (state == LOW) {
      showType++;
      if (showType > 5)
        showType=0;
     startShow(showType); 
   }

state = HIGH;
}

void changeState(){
  state = !state;
}

void startShow(int i) {
  switch(i) {
    case 0: colorWipe(0, 0, 0);    // Black/off
            break;
    case 1: colorWipe(255, 0, 0);  // Redstone
            break;
    case 2: colorWipe(0, 255, 0);  // Emerald
            break;
    case 3: colorWipe(0, 0, 255);  // Lapis Lazuli
            break;
    case 4: colorWipe(255, 100, 0);  // Gold
            break;
    case 5: colorWipe(100, 245, 228);  // Diamond
            break;  
            
  }
}


// Fill the dot with a color
void colorWipe(int r, int g, int b) {

  analogWrite(RED_PIXEL_PIN, r);
  analogWrite(GRN_PIXEL_PIN, g);
  analogWrite(BLU_PIXEL_PIN, b);
}

Please post a link or image of that. There is too much room for error in a brief forum post description. You said, "it has a +" but LEDs are typically not labelled.

Nice image. But it is imaginary hardware not real. I need to know what you actually have.

I made a small error. I corrected it now. Copy the code again.

I have a RGB strip that has + pin green, blue and red pin. Also a arduino nano V3 https://www.amazon.es/gp/product/B01LWSJBTD/ref=ox_sc_act_title_1?smid=A1X7QLRQH87QA3&th=1 and a button

Aha, a strip. I suspected so. In that case, the current limiting resistors aren't needed, they are provided on the strip.

But, I'm asking you for links or images of actual hardware. You are using words for two of the things you mentioned...

Dang!

Corrected again.