This is awesome, but there's a slight bug in this implementation: Wordle won't count additional instances of a letter as wrong-position, it'll just flag them as wrong. For example, if the word is TRACE, and I guess TRACT, the first T will be green, but the second T should be black, not yellow. In this implementation, at the moment, TRACT would return GGGGY, but in Wordle it would be GGGGB.
I actually made the same mistake in a Wordle solver I was writing recently - it's easy to miss, since Wordle doesn't make this explicit and you have to infer it yourself.
I have been trying to figure this out myself. The algorithm I'm using is to colour yellow only if the count of that letter before that occurance in the guess, is less than the count of that letter in the target word.
I actually made the same mistake in a Wordle solver I was writing recently - it's easy to miss, since Wordle doesn't make this explicit and you have to infer it yourself.