C (gcc), 157 153 143 143139 bytes
Saved several bytes thanks to @AlexeyBurdin
Saved 4 more bytes thanks to @ceilingcat
long p,a,s,c,L;f(n,d){for(a=0;a++<n;puts(""))for(c=a+~n;c<a;printfc=a+~n;p=c<a;printf(c<0?" ":"\e[3%dm@@",L),s=++c<1?1:s*a/c-s)for(L=0,p=1;p*=dL=0;p*=d,L<7&&!(s%p);L++L<7&s%p<1;L++);}
Try it online!Try it online! (no colors on TIO)
long p, a, s, c, L; // declare a few 64-bit integers
f(n, d) { // n = number of rows, d = colorization parameter
for(a = 0; a++ < n; puts("")) // for a = 1 to n, with a linefeed added after each
for( // iteration:
c = a + ~n; // for c = a - n - 1 to a - 1:
p = c < a; //
printf( // update the output after each iteration:
c < 0 ? // if c is negative:
" " // just append a space
: // else:
"\e[3%dm@@", // append the ANSI color code, followed by '@@'
L // set the 2nd digit of the color code
), //
s = ++c < 1 ? 1 // increment c; set s to 1 while c is less than 1
: s * a / c - s // then, update s to s * a / c - s
) //
for( // compute the color L:
L = 0,0; p = 1; // start with L = 0, p = 1
p *= d, // multiply p by d
L < 7 &&& !(s % p); < 1; // stop if L=7L = 7 or p does not divide s
L++ // increment L
); //
} //