If you are able to place the text in color you can add the colors as swatches from the Swatches panel flyout menu (Add unnamed colors), then create a character style to apply each color. Use Find/Change to find text that has the color applied and set the change format to the new character style before you remove paragraph style overrides.
Are there different colors within the same paragraph? If that's the case there would have to be Character styles applied within the paragraphs to handle the changing colors.
Paragraph and Character Styles can/should be applied in Word and be imported into InDesign.
Thanks for the update.
I would be interested if there is a possibility that the color applied to different paragraph styles in Indesign could be converted to styles.
Is there any plugin or script which would help us to do the same.
Thanks in advance for the support.
The short answer is yes.
There are a number of scripts that look for text formatting and define and assign styles based on the format. One of the best is Jongware's preptext script, but I don't think it does colors.
In order to do this you would have to define all the colors used first (add unnamed colors ought to work, and that can be done as part of the script) and then the script would simply automate the procedure described in my first response above.
Thank you Peter
You should be able to do it via Find & Change.
So here I have some sample HTML that has a Paragraph style named Code Paragraph and the paragraphs have a mix of colors. I've made a corresponding Character Style for each code style instance. In F&C I'm leaving the Find What and Change To fields blank. In Find Format I clicked the text find icon and chose the color to find and in Change Format I chose the Character Style for that color:
Now all of the red tag text is styled with Tags so Code Paragraph doesn't show as overridden when the red text is selected
Thank you for the screenshot explanation. I will definitely try it.