My algorithm will probably be almost the same as the others but I just wanna show another way. So my answer is
Require 3 guesses to guarantee know the colour
My explanation
Label my colours as A, B, C, D, E, F, G and H
First Guess: ABBCCC. If 0 match, the colour is D, E, F, G or H. If 1 match, the colour A. If 2 matches, the colour is B. If 3 matches, the colour is C.
If 0 match in the first guess, proceed to second guess.
Second guess: DEEFFF. Same logic as first guess. If 0 match, the colour is either G or H. If 1 match the colour D. If 2 matches, the colour is E. If 3 matches, the colour is F.
If 0 match in the second guess, proceed to third guess.
Third guess: GGGGGG: If all correct, the colour is G. If all wrong, the colour is H.