I have to create a texture using 4 different elements (call them A,B,C,D or whatever you want) on a 6x7 grid. The goal is to obtain a pattern with the least repetitions of the same element in horizontal, vertical and diagonal directions, especially, if possible, should be avoided to repeat the same element in adjacent blocks. I think there should be different solution to this, just answer with what you came up with.
Starting from the nucleus
$$a b a\\ b c b\\ a b a\\$$
add "layers" of two characters alternating onto the nucleus. For example, the next iteration will be
$$c d c d c\\ d a b a d\\ c b c b c\\ d a b a d\\ c d c d c\\$$
This array can be extended infinitely, and all elements of this infinite array will have neighbours in all 8 directions that are different from itself, except at the corners.
$$c d c d c d\\ a b a b a b\\ c d c d c d\\ a b a b a b\\ c d c d c d\\ a b a b a b\\ c d c d c d\\$$
Simply take a 6x7 subset of this infinite array at any position where no corner exists to produce an answer.