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

Support colorized outputs on Linux #44

Merged
merged 2 commits into from
Sep 11, 2024
Merged

Support colorized outputs on Linux #44

merged 2 commits into from
Sep 11, 2024

Conversation

matyalatte
Copy link
Owner

Related to #35. Added support for some ANSI escape sequences (\e[XXm) on GTK window.
You can use bold, italic, underline, strikethrough, and colors.

ANSI on Linux

#!/bin/bash
# test.sh

cases=(
  $'\033[1mBold text\033[0m'                             # Bold text
  $'\033[3mItalic text\033[0m'                           # Italic text
  $'\033[4mUnderlined text\033[0m'                       # Underlined text
  $'\033[9mStrikethrough text\033[0m'                    # Strikethrough text
  $'\033[31mRed foreground\033[0m'                       # Red foreground
  $'\033[44mBlue background\033[0m'                      # Blue background
  $'\033[1;32mBold Green foreground\033[0m'              # Bold + Green foreground
  $'\033[1;41mBold Red on Red background\033[0m'         # Bold + Red background
  $'\033[1;3;4;9;34mBold Italic Underlined Strikethrough Blue\033[0m'  # Multiple styles
  $'Regular text with \033[1msome bold\033[0m and \033[4munderline\033[0m.' # Mixed styles
  $'\033[31mRed & Blue\033[34m combination\033[0m'       # Mixed colors
  $'Special characters: & < > \' "'                      # Special characters that need escaping
  $'\033[31mRed multiline'
  $'Red multiline\033[0m'
)

for case in "${cases[@]}"; do
  echo "$case"
  sleep 0.1
done

@matyalatte matyalatte mentioned this pull request Sep 10, 2024
3 tasks
@matyalatte matyalatte merged commit 5bf7242 into main Sep 11, 2024
9 checks passed
@matyalatte matyalatte deleted the ansi_escape_with_gtk branch September 13, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant