Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add missing terminal styles #162

Merged
merged 1 commit into from
Nov 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions src/Themes/TerminalStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ enum TerminalStyle: string
{
case ESC = "\033[";
case RESET = "0m";
case RESET_INTENSITY = "22m";
case RESET_ITALIC = "23m";
case VISIBLE = "28m";
case RESET_UNDERLINE = "24m";
case RESET_OVERLINE = "55m";
case RESET_STRIKETHROUGH = "29m";
case NON_REVERSE_TEXT = "27m";

case FG_BLACK = "30m";
case FG_DARK_RED = "31m";
Expand Down Expand Up @@ -44,10 +51,18 @@ enum TerminalStyle: string
case BG_WHITE = "107m";

case BOLD = "1m";
case DIM = "2m";
case ITALIC = "3m";
case UNDERLINE = "4m";
case NO_UNDERLINE = "24m";
case OVERLINE = "53m";
case HIDDEN = "8m";
case STRIKETHROUGH = "9m";
case REVERSE_TEXT = "7m";
case NON_REVERSE_TEXT = "27m";

public static function STYLE(self $style, string $text): string
{
return self::ESC->value . $style->value . $text;
}

public static function RESET(string $text = ''): string
{
Expand Down Expand Up @@ -216,26 +231,41 @@ public static function BG_WHITE(string $text = ''): string

public static function BOLD(string $text = ''): string
{
return self::ESC->value . self::BOLD->value . $text . self::ESC->value . self::RESET->value;
return self::ESC->value . self::BOLD->value . $text . self::ESC->value . self::RESET_INTENSITY->value;
}

public static function DIM(string $text = ''): string
{
return self::ESC->value . self::DIM->value . $text . self::ESC->value . self::RESET_INTENSITY->value;
}

public static function ITALIC(string $text = ''): string
{
return self::ESC->value . self::ITALIC->value . $text . self::ESC->value . self::RESET_ITALIC->value;
}

public static function UNDERLINE(string $text = ''): string
{
return self::ESC->value . self::UNDERLINE->value . $text . self::ESC->value . self::RESET->value;
return self::ESC->value . self::UNDERLINE->value . $text . self::ESC->value . self::RESET_UNDERLINE->value;
}

public static function NO_UNDERLINE(string $text = ''): string
public static function OVERLINE(string $text = ''): string
{
return self::ESC->value . self::NO_UNDERLINE->value . $text . self::ESC->value . self::RESET->value;
return self::ESC->value . self::OVERLINE->value . $text . self::ESC->value . self::RESET_OVERLINE->value;
}

public static function REVERSE_TEXT(string $text = ''): string
public static function HIDDEN(string $text = ''): string
{
return self::ESC->value . self::REVERSE_TEXT->value . $text . self::ESC->value . self::RESET->value;
return self::ESC->value . self::HIDDEN->value . $text . self::ESC->value . self::VISIBLE->value;
}

public static function NON_REVERSE_TEXT(string $text = ''): string
public static function STRIKETHROUGH(string $text = ''): string
{
return self::ESC->value . self::STRIKETHROUGH->value . $text . self::ESC->value . self::RESET_STRIKETHROUGH->value;
}

public static function REVERSE_TEXT(string $text = ''): string
{
return self::ESC->value . self::NON_REVERSE_TEXT->value . $text . self::ESC->value . self::RESET->value;
return self::ESC->value . self::REVERSE_TEXT->value . $text . self::ESC->value . self::NON_REVERSE_TEXT->value;
}
}
Loading