<human>:  Give me a Python function to write text to a file with different color.
<bot>: Here is a Python function to write text to a file with different color

import os

def write_file(file_name, text, color):
  """
  Write text to file with different color

  :param file_name: file name
  :type file_name : str
  :param text: text to be written
  :type text : str
  :param color: color to be written
  :type color : str
  :return: None
  """
  with open(file_name, 'w') as f:
    f.write(color + text + '\n')

# Enter the file name
file_name = "test.txt"

# Enter the text
text = "This is a test"

# Enter the color
color = "red"

# Calling the function
print((write_file(file_name, text, color)))

#Example Output
# None

#Remember to inspect code for bugs.