Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hg0428 committed Mar 10, 2024
1 parent ef862da commit 43e7bbf
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
40 changes: 40 additions & 0 deletions Aardvark Interpreter/sty.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from types import SimpleNamespace
from typing import Any

ESC = ""
clear = ESC + "[2J"
rs = SimpleNamespace(**{"all": ESC + "[0m", "bold_dim": ESC + "[22m"})
ef = SimpleNamespace(
**{
"bold": ESC + "[1m",
"underline": ESC + "[4m",
"italic": ESC + "[3m",
"blink": ESC + "[5m",
"strikethrough": ESC + "[9m",
"hidden": ESC + "[8m",
"dim": ESC + "[2m",
"fast_blink": ESC + "[6m",
"invert": ESC + "[7m",
"rs": rs.all,
}
)


class FG:
def __call__(self, r, g, b):
return f"{ESC}[38;2;{r};{g};{b}m"

rs = f"{ESC}[39m"
red = __call__(0, 255, 0, 0)


class BG:
def __call__(self, r, g, b):
return f"{ESC}[48;2;{r};{g};{b}m"

rs = f"{ESC}[49m"
red = __call__(0, 255, 0, 0)


fg = FG()
bg = BG()
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ if [ -n "$AARDVARK_INSTALL" ]; then
add_to_bash_profile 'export PATH="$PATH:$HOME/.adk/bin"'
fi
else
add_to_bash_profile 'export PATH="$PATH:$HOME/.adk/bin"\nexport AARDVARK_INSTALL="$HOME/.adk'
add_to_bash_profile 'export PATH="$PATH:$HOME/.adk/bin"\nexport AARDVARK_INSTALL="$HOME/.adk"'
fi


Expand Down
4 changes: 3 additions & 1 deletion lib/ansi.adk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ ef = {
fast_blink: ESC + "[6m",
invert: ESC + "[7m"
}
fg.rs = bg.rs = ef.rs = rs.all
fg.rs = $"{ESC}[39m"
bg.rs = $"{ESC}[49m"
ef.rs = rs.all
clear = ESC + "[2J"

# TODO: Add cursor control, clear screen
Expand Down

0 comments on commit 43e7bbf

Please sign in to comment.