コード例 #1
0
 def test_get_code_pass(self):
     bright_green = ColorCodes(
             Values.Color.green,
             Values.Target.foreground,
             Values.Intensity.bright,
             underline=False, bold=False
     )
     self.assertEqual(bright_green.get_code(), '\x1b[92m')
     return None
コード例 #2
0
def main():
    """"Create a ColorCode object and use with print()."""
    bright_green = ColorCodes(
        Values.Color.green, Values.Target.foreground, Values.Intensity.bright, underline=False, bold=False
    )

    print(
        "{}This text is green. "
        "{}And the color on this text has been reset.".format(bright_green.get_code(), bright_green.reset_code)
    )
    print("")
    print("The escape sequence used to change " "the text color is: {}".format(bright_green.code))
    return None