コード例 #1
0
 def testToggleColors(self):
     print()
     print(colors.fg.red["This is in red"], "but this is not")
     print(colors.fg.green + "Hi, " + colors.bg[23] + "This is on a BG" +
           ~colors.bg + " and this is not")
     colors.yellow.print("This is printed from color.")
     colors.reset()
コード例 #2
0
ファイル: test_visual_color.py プロジェクト: tigrawap/plumbum
 def testToggleColors(self):
     print()
     print(colors.fg.red["This is in red"], "but this is not")
     print(colors.fg.green + "Hi, " + colors.bg[23]
           + "This is on a BG" + ~colors.bg + " and this is not")
     colors.yellow.print("This is printed from color.")
     colors.reset()
コード例 #3
0
ファイル: test_visual_color.py プロジェクト: astraw38/plumbum
    def testToggleColors(self):
        print()
        print(colors.fg.red["This is in red"], "but this is not")
        print(colors.fg.green + "Hi, " + colors.bg[23] + "This is on a BG" + ~colors.bg + " and this is not")
        colors.yellow.print("This is printed from color.")
        colors.reset()

        for attr in colors._style.attribute_names:
            print("This is", attr | getattr(colors, attr), "and this is not.")
            colors.reset()
コード例 #4
0
    def testToggleColors(self):
        print()
        print(colors.fg.red["This is in red"], "but this is not")
        print(colors.fg.green + "Hi, " + colors.bg[23] + "This is on a BG" +
              ~colors.bg + " and this is not but is still green.")
        colors.yellow.print("This is printed from color.")
        colors.reset()

        for attr in colors._style.attribute_names:
            print("This is", attr | getattr(colors, attr), "and this is not.")
            colors.reset()
コード例 #5
0
#!/usr/bin/env python

from plumbum import colors

with colors.fg.red:
    print("This is in red")

print("This is completely restored, even if an exception is thrown!")

print("The library will restore color on exiting automatically.")
print(colors.bold["This is bold and exciting!"])
print(colors.bg.cyan | "This is on a cyan background.")
print(colors.fg[42]
      | "If your terminal supports 256 colors, this is colorful!")
print()
for c in colors:
    print(c + "\u2588", end="")
colors.reset()
print()
print("Colors can be reset " + colors.underline["Too!"])
for c in colors[:16]:
    print(c["This is in color!"])

colors.red()
print("This should clean up the color automatically on program exit...")
コード例 #6
0
ファイル: color.py プロジェクト: AndrewPashkin/plumbum
#!/usr/bin/env python
from __future__ import with_statement, print_function

from plumbum import colors

with colors.fg.red:
    print('This is in red')

print('This is completly restored, even if an exception is thrown!')

print('The library will restore color on exiting automatially.')
print(colors.bold["This is bold and exciting!"])
print(colors.bg.cyan | "This is on a cyan background.")
print(colors.fg[42] | "If your terminal supports 256 colors, this is colorful!")
print()
for c in colors:
    print(c + u'\u2588', end='')
colors.reset()
print()
print('Colors can be reset ' + colors.underline['Too!'])
for c in colors[:16]:
    print(c["This is in color!"])

colors.red()
print("This should clean up the color automatically on program exit...")