change colour of output to terminal c++

#include <iostream>

int main() {
    // Change text color to red
    std::cout << "\033[1;31mThis is red text!\033[0m" << std::endl;

    return 0;
}