You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stycurrently supports features that don't work with some dated terminals, e.g. terminal.app (see #12, #14). There are other terminals that don't work with the common ANSI sequences, e.g. cmd, powershell. (see #2)
Feature Sets
If you are planning to support a wide range of terminals, it would be good if you could restrict sty to the features you are allowed to use.
With a del_styles_of_type function, you could, for example, remove rgb colors in order to support apple's terminal.app:
The default environment enables you to use the full feature set of sty using the most common ANSI escape sequences. This is the environment which sty uses by default.
# Get default env register-objects.ef, fg, bg, rs=sty.env.default()
# Or set default env globally (be careful with this).sty.env.default(set_globally=True)
windows Environment
The windows environment uses windows specific ANSI sequences and allows only the features that work with cmd/powershell.
# Get windows compatible register-objectsef, fg, bg, rs=sty.env.windows()
# Or set windows compatible register-objects globally (be careful with this).sty.env.windows(set_globally=True)
In a real world app, you might call something like this in __init__.py of you application:
Environments & Feature Sets (Planning)
sty
currently supports features that don't work with some dated terminals, e.g.terminal.app
(see #12, #14). There are other terminals that don't work with the common ANSI sequences, e.g.cmd
,powershell
. (see #2)Feature Sets
If you are planning to support a wide range of terminals, it would be good if you could restrict sty to the features you are allowed to use.
With a
del_styles_of_type
function, you could, for example, removergb
colors in order to support apple'sterminal.app
:This would remove attributes that use rgb colors from the default
fg
andbg
register, restricting sty to the feature set ofterminal.app
.If you don't want to support
eightbit
colors, you could use this:The code above would remove eightbit styles such as
da_green
,da_red
,da_*
from the defaultfg
andbg
register.There could be a batch function to delete from multiple objects at once:
Environments
Configuration preset for common environments.
default
EnvironmentThe
default
environment enables you to use the full feature set of sty using the most common ANSI escape sequences. This is the environment which sty uses by default.windows
EnvironmentThe
windows
environment uses windows specific ANSI sequences and allows only the features that work withcmd
/powershell
.In a real world app, you might call something like this in
__init__.py
of you application:Or better add a
style.py
to you project and use this:Now you can import the registers from
style.py
, e.g.:from .style import ef, fg, bg, rs
The text was updated successfully, but these errors were encountered: