Check out example codes for "typescript how to color your console loggers". It will help you in understanding the concepts better.

Code Example 1

//has to be backtick comma to interpolate.
public colorLogger(str: any, color = "red"){
    console.log(`%c ${str}`, `color: ${color}; font-weight: bold;`);
}

Learn ReactJs, React Native from akashmittal.com