It depends on the content of the thoughts. Mortal sin would require malicious thoughts. For example, thoughts of harming someone because of their race. Thinking your race is superior would be sin but only venial sin, again unless you are wanting to seriously harm others. You can think of it as a character flaw to be worked on. Anytime you have thoughts like this, pray for those people instead. Put yourself in their shoes. I find this builds solidarity in the heart, so you can see them as God sees them. God loves all people very much. Also confess these sins to Jesus every night, so he can make you holy.