I entered several numbers to a red black tree. (41; 38; 31; 12; 19; 8) after deleting 8 and 12 (1st screenshot) it got into the type of the second screenshot. I can't understand why that 31 turn into red . Please help me with that ? If you could please mention the case related to that. Thank you !

If you check the explanation of the removal algorithm on Wikipedia, you can map their naming of nodes to your tree as follows:
M = 0012, the black node to remove
C = a NIL leaf below 0012 (NILs are always considered to be black)
The article goes on to say about your actual case:
So now we have after the removal, but before re-colouring:
P = 0019 (red)
N = a NIL leaf, the left child of 0019
S = 0031, the right child of 0019
The description identifies several cases, and the case at hand is the following one:
The reason for this colour swap is explained:
Recall that in Red Black trees this invariant must be maintained (property 5):
This invariant would have been violated if the above colour-swap were omitted.