Need help controlling an RGB LED matrix directly from arduino pins.

I would love some help on a RGB Matrix that I am controlling straight from the arduino. All of the projects I have seen on this site that deal with Matrices use shift registers and pre made libraries to control the matrix.

My goal is to come up with an easy way to output color other than the standard red, green, and blue.

The way I make custom colors now is by creating a function for the specific color and location and run it in the loop. For example, in the code below, the matrix is running pink in the two leftmost LED's. I would appreciate it very much if someone can tell me how I can create custom colors more efficiently. I am not opposed to rewriting the entire code, so all suggestions are welcomed.

CODE:

//The matrix is multiplexed so that the rows of colors are connected, and three cathode lines run through the columns.
//In other words, r2 connects all of the red led's in the top row, and r1 connects all of the led's in the bottom row.
//C1 connects all of the cathodes in the first column, C2 the second, C3 the third

int r2=5; int g2=6; int b2=7;//r2,g2,b2 are the top led colors
int r1=2; int g1=3; int b1=4;//r1,g1,b1 are the bottom led colors
int c1=A3; int c2=A4; int c3=13;      //cathodes

int cathodes[]={c1, c2, c3};
int top[] = {5,6,7};
int bottom[] = {2,3,4};

//timer
unsigned long previousmillis=0;
const long interval=800;
int tim=0;
int z = 1;

int pink2[]={r2,r2,b2};
int pink1[]={r1,r1,b1};

int matrix[2][3];//This is the array that activates the pins in the for loop further down.

//I'm not entirely sure if this is actually a buffer, but it is where you can directly write to the matrix.
//The picture shows pink for the first column. This will be explained further down.
int buff[2][3]={
  {b2,b2,r2},
  {b1,b1,g1}
};

void clr(){
  pinMode(r1,INPUT);pinMode(r2,INPUT);pinMode(g1,INPUT);pinMode(g2,INPUT);pinMode(b1,INPUT);pinMode(b2,INPUT);pinMode(c1,INPUT);pinMode(c2,INPUT);pinMode(c3,INPUT);
}
void refresh_buff(){  //This is where "buff" transfers its data

for (int x=0; x<2; x++){
 for (int y=0; y<3; y++){
   matrix[x][y] = buff[x][y];
}
}
  
}

void refresh(){
//This is where the pins get activated. 
for (int w=0; w<3; w++){
  pinMode(matrix[1][w],OUTPUT);pinMode(matrix[0][w],OUTPUT);
    digitalWrite(matrix[1][w],HIGH);digitalWrite(matrix[0][w],HIGH);
    
    pinMode(cathodes[w],OUTPUT);
    digitalWrite(cathodes[w],LOW);
    delay(1);
    pinMode(matrix[1][w],INPUT);pinMode(matrix[0][w],INPUT);
    pinMode(cathodes[w],INPUT);
}
  
}


//This is the reason why the first column is pink. This for loop puts all of the led's in the "int pink1" and "int pink2" in the matrix. I would like a better system than this.
void pink(){    
   for(int frame = 0; frame < 3; frame++){

        matrix[1][0] = {pink1[frame]};
        matrix[0][0] = {pink2[frame]};
        refresh();
    }
}
void setup() {//Setting up the matrix
  refresh_buff();

  clr();
  
}

void loop() {
  refresh();
  pink();
  
}

PICTURE OF CODE RUNNING:

You need to up the matrix refresh rate, and refresh to a different buffer each time. Each buffer will have a specific LED on or off, the ratio of the number of buffers containing a lit LEDto that containing an unlit LED will set the brightness.

Pretty inefficient but it will work.