![]() ![]() There is unfortunately no way to know whether the current emulator supports more than eight colors, which makes the choice of colors difficult. Capitalize these strings for the constant interface. The same applies for background colors: on_red is the normal color and on_bright_red is the bright color. For example, red is color 1 and bright_red is color 9. For every normal color (0 through 7), the corresponding bright color (8 through 15) is obtained by prepending the string bright_ to the normal color name. Some sixteen-color terminal emulators also treat normal yellow (color 3) as orange or brown, and bright yellow (color 11) as yellow.įollowing the normal convention of sixteen-color emulators, this module provides a pair of attributes for each color. Bright black usually is a dark grey color, although some terminals display it as pure black. On such emulators, the "normal" white (color 7) usually is shown as pale grey, requiring bright white (15) to be used to get a real white color. Emulators that support 16 colors, such as gnome-terminal, normally display colors 0 through 7 as dim or darker versions and colors 8 through 15 as normal brightness. Emulators that only support eight colors (such as the Linux console) will display colors 0 through 7 with normal brightness and ignore colors 8 through 15, treating them the same as white. Unfortunately, interpretation of colors 0 through 7 often depends on whether the emulator supports eight colors or sixteen colors. These colors are referred to as ANSI colors 0 through 7 (normal), 8 through 15 (16-color), 16 through 255 (256-color), and true color (called direct-color by xterm). This module provides the ANSI escape codes for all of them. Terminal emulators that support color divide into four types: ones that support only eight colors, ones that support sixteen, ones that support 256, and ones that support 24-bit color. See "COMPATIBILITY" for the versions of Term::ANSIColor that introduced particular features and the versions of Perl that included them. See "Supporting CLICOLOR" for more information. ![]() If you are using Term::ANSIColor in a console command, consider supporting the CLICOLOR standard. It also offers the utility functions uncolor(), colorstrip(), colorvalid(), and coloralias(), which have to be explicitly imported to be used (see "SYNOPSIS"). This module has two interfaces, one through color() and colored() and the other through constants. Print POPCOLOR "Back to whatever we started as.\n" DESCRIPTION Print ON_BLUE "This text is red on blue.\n" Print LOCALCOLOR GREEN ON_BLUE "This text is green on blue.\n" Print POPCOLOR "Back to red on green.\n" Print RESET BRIGHT_BLUE "This text is just bright blue.\n" Print PUSHCOLOR BRIGHT_BLUE "This text is bright blue on green.\n" Print PUSHCOLOR RED ON_GREEN "This text is red on green.\n" Print BOLD BLUE "This text is in bold blue.\n" Print BOLD, BLUE, "This text is in bold blue.\n", RESET Print colored("This is in red.", 'alert'), "\n" Print "Alert is ", coloralias('alert'), "\n" Print "Color string is ", $valid ? "valid\n" : "invalid\n" ![]() My $valid = colorvalid('blue bold', 'on_magenta') Print colorstrip("\e[1mThis is bold\e[0m"), "\n" # Map escape sequences back to color names. Print colored(, 'Bright red on black.', "\n") Print colored(, 'Red on bright yellow.', "\n") Print colored(, 'Yellow on magenta.', "\n") Print colored("Yellow on magenta.", 'yellow on_magenta'), "\n" Actually, the same occur with tput via $ printf 'Doing some task.Term::ANSIColor - Color screen output using ANSI escape sequences SYNOPSIS use Term::ANSIColor I searched and read the many questions about, but I did not find anything about this behaviour I experienced. If this should not happen, might this behaviour be triggered indirectly by something in my environment?. ![]() Is this the intended desired behaviour? If so, how would I get the done! printed after the task.?.Where the done! is horizontally at the correct position but not vertically (correct in the sense of restored). For example: $ printf 'Doing some task.\e[s\n\nMore text\n\e[udone!\n\n\n' However, it seems that this ANSI sequences restore only the horizontal position of the cursor. Source: Bash Prompt HOWTO: Cursor movement The movement escape sequences are as follows: This is more useful for full screen user interfaces generated by shell scripts, but can also be used in prompts. Saving and restoring the cursor position should be possible with simple ANSI escape sequencesĪNSI escape sequences allow you to move the cursor around the screen at will. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |