How to use the sty.Sgr function in sty

To help you get started, we’ve selected a few sty examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github feluxe / sty / tests / docs / customizing.py View on Github external
def __init__(self):

        super().__init__()

        self.set_renderfunc(Sgr, renderfunc.sgr)
        self.set_renderfunc(EightbitFg, renderfunc.eightbit_fg)
        self.set_renderfunc(RgbFg, renderfunc.rgb_fg)

        self.set_eightbit_call(EightbitFg)
        self.set_rgb_call(RgbFg)

        self.red = Style(Sgr(31))
        self.green = Style(Sgr(32))
        self.rs = Style(Sgr(39))
        self.yellow = Style(RgbFg(250, 250, 70))
        # ...
github feluxe / sty / tests / docs / customizing.py View on Github external
def __init__(self):

        super().__init__()

        self.set_renderfunc(Sgr, renderfunc.sgr)
        self.set_renderfunc(EightbitFg, renderfunc.eightbit_fg)
        self.set_renderfunc(RgbFg, renderfunc.rgb_fg)

        self.set_eightbit_call(EightbitFg)
        self.set_rgb_call(RgbFg)

        self.red = Style(Sgr(31))
        self.green = Style(Sgr(32))
        self.rs = Style(Sgr(39))
        self.yellow = Style(RgbFg(250, 250, 70))
        # ...
github feluxe / sty / tests / docs / customizing.py View on Github external
def __init__(self):

        super().__init__()

        self.set_renderfunc(Sgr, renderfunc.sgr)
        self.set_renderfunc(EightbitFg, renderfunc.eightbit_fg)
        self.set_renderfunc(RgbFg, renderfunc.rgb_fg)

        self.set_eightbit_call(EightbitFg)
        self.set_rgb_call(RgbFg)

        self.red = Style(Sgr(31))
        self.green = Style(Sgr(32))
        self.rs = Style(Sgr(39))
        self.yellow = Style(RgbFg(250, 250, 70))
        # ...
github feluxe / sty / tests / docs / customizing.py View on Github external
def __init__(self):

        super().__init__()

        # Add custom style attributes.

        self.purple = Style(Sgr(35))
        self.blue = Style(Sgr(34))
        self.orange = Style(RgbFg(255, 128, 0))
        # ...
github feluxe / sty / tests / docs / customizing.py View on Github external
def __init__(self):

        super().__init__()

        # Add custom style attributes.

        self.purple = Style(Sgr(35))
        self.blue = Style(Sgr(34))
        self.orange = Style(RgbFg(255, 128, 0))
        # ...
github feluxe / sty / tests / docs / customizing.py View on Github external
# ===== Start =====
Example("customizing the register-objects: assignment")
from sty import fg, ef, rs, Style, RgbFg, Sgr

fg.my_red = Style(RgbFg(255, 0, 0))

a = fg.my_red + 'This text has red fg.' + fg.rs

print(a)
# ===== End =====

# ===== Start =====
Example("customizing the register-objects: compose")
from sty import fg, ef, rs, Style, RgbFg, Sgr

fg.blue_bold = Style(RgbFg(0, 100, 200), Sgr(1))
fg.green_italic = Style(fg.green, ef.i)

a = fg.blue_bold + 'This text has bold blue fg.' + rs.all
b = fg.green_italic + 'This text has italic green fg' + rs.all

print(a, b, sep='\n')
# ===== End =====

# ===== Start =====
Example("customizing the register-objects: set_style")
from sty import fg, RgbFg

fg.set_style('my_red', RgbFg(255, 0, 0))

a = fg.my_red + 'This text has red fg.' + fg.rs
github feluxe / sty / tests / docs / customizing.py View on Github external
# ===== Start =====
Example("customizing the register-objects: set_style")
from sty import fg, RgbFg

fg.set_style('my_red', RgbFg(255, 0, 0))

a = fg.my_red + 'This text has red fg.' + fg.rs

print(a)
# ===== End =====

# ===== Start =====
Example("customizing the register-objects: render_types")
from sty import fg, Sgr, RgbFg, EightbitFg

fg.set_style('my_sgr_red', Sgr(31))
fg.set_style('my_eightbit_red', EightbitFg(196))
fg.set_style('my_rgb_red', RgbFg(255, 0, 0))

a = fg.my_sgr_red + 'This text has a red fg.' + fg.rs
b = fg.my_eightbit_red + 'This text has a red fg.' + fg.rs
c = fg.my_rgb_red + 'This text has a red fg.' + fg.rs

print(a, b, c, sep='\n')
# ===== End =====

# ===== Start =====
Example("customizing the register-objects: get_style")
from sty import ef, fg, rs

# Make fg.green_i render a green and itelic foreground.
fg.set_style('green_i', fg.get_style('green'), ef.get_style('italic'))