{"id":19263535,"url":"https://github.com/trapd00r/term-extendedcolor","last_synced_at":"2025-08-09T03:51:36.193Z","repository":{"id":1163750,"uuid":"1054148","full_name":"trapd00r/Term-ExtendedColor","owner":"trapd00r","description":"Color screen output using extended escape sequences  ","archived":false,"fork":false,"pushed_at":"2024-06-08T08:08:05.000Z","size":120,"stargazers_count":17,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T15:11:46.040Z","etag":null,"topics":["256-colors","colors","console","ecma-48","escape-sequences","perl","terminal"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/Term-ExtendedColor","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trapd00r.png","metadata":{"files":{"readme":"README","changelog":"Changes","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"trapd00r"}},"created_at":"2010-11-05T13:41:20.000Z","updated_at":"2022-09-17T09:08:48.000Z","dependencies_parsed_at":"2024-11-09T19:47:30.437Z","dependency_job_id":null,"html_url":"https://github.com/trapd00r/Term-ExtendedColor","commit_stats":{"total_commits":156,"total_committers":6,"mean_commits":26.0,"dds":0.25,"last_synced_commit":"db58063d24dff711cd355b2a6cdab44f596a3222"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FTerm-ExtendedColor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FTerm-ExtendedColor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FTerm-ExtendedColor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trapd00r%2FTerm-ExtendedColor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trapd00r","download_url":"https://codeload.github.com/trapd00r/Term-ExtendedColor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250111002,"owners_count":21376570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["256-colors","colors","console","ecma-48","escape-sequences","perl","terminal"],"created_at":"2024-11-09T19:36:08.251Z","updated_at":"2025-04-21T18:31:39.000Z","avatar_url":"https://github.com/trapd00r.png","language":"Perl","funding_links":["https://github.com/sponsors/trapd00r"],"categories":[],"sub_categories":[],"readme":"NAME\n    Term::ExtendedColor - Color screen output using 256 colors\n\nSYNOPSIS\n        use Term::ExtendedColor qw(:all);\n\n        # Or use the 'attributes' tag to only import the functions for setting\n        # attributes.\n        # This will import the following functions:\n\n        # fg(), bg(), bold(), underline(), inverse(), italic(), clear()\n        use Term::ExtendedColor ':attributes';\n\n        ## Foreground colors\n\n        my $red_text = fg('red2', 'this is in red');\n        my $spring   = fg('springgreen3', 'this is green');\n\n        ## Background colors\n\n        print bg('red5', \"Default foreground text on dark red background\"), \"\\n\";\n        my $red_on_green = fg('red3', bg('green12', 'Red text on green background'));\n        print \"$red_on_green\\n\";\n\n        ## Fall-through attributes\n\n        Term::ExtendedColor::autoreset(0);\n        my $bold  = fg('bold', 'This is bold');\n        my $red   = fg('red2', 'This is red... and bold');\n        my $green = bg('green28', 'This is bold red on green background');\n\n        # Make sure to clear all attributes when autoreset turned OFF,\n        # or else the users shell will be messed up\n\n        my $clear = clear();\n        print \"$bold\\n\";\n        print \"$red\\n\";\n        print \"$green $clear\\n\";\n\n        ## Non-color attributes\n\n        # Turn on autoreset again\n        Term::ExtendedColor::autoreset(1);\n\n        for(qw(italic underline blink reverse bold)) {\n          print fg($_, $_), \"\\n\";\n        }\n\n        # For convenience\n\n        my $bolded = bold(\"Bold text!\");\n        my $italic = italic(\"Text in italics!\");\n\n        ## Remove all attributes from input data\n        my @colored;\n        push(@colored, fg('bold', fg('red2', 'Bold and red')));\n        push(@colored, fg('green13', fg('italic', 'Green, italic')));\n\n        print \"$_\\n\" for @colored;\n        print \"$_\\n\" for uncolor(@colored);\n\nDESCRIPTION\n    Term::ExtendedColor provides functions for sending so called extended\n    escape sequences to the terminal. This ought to be used with a 256-color\n    compatible terminal; see the NOTES section for a matrix of terminal\n    emulators currently supporting this.\n\nEXPORTS\n    None by default.\n\n    Two tags are provided for convience:\n\n      # Import all functions\n      use Term::ExtendedColor qw(:all);\n\n      # Import functions for setting attributes\n      # fg(), bg(), bold(), italic(), underline(), inverse(), clear()\n      use Term::ExtendedColor qw(:attributes);\n\nFUNCTIONS\n  fg($color, $string)\n      my $green = fg('green2', 'green foreground');\n      my @blue  = fg('blue4',  ['takes arrayrefs as well']);\n\n      my $x_color = fg('mediumorchid1', 'Using mappings from the X11 rgb.txt');\n\n      my $arbitary_color = fg(4, 'This is colored in the fifth ANSI color');\n\n      my $raw_seq = fg('38;5;197;48;5;53;1;3;4;5;7', 'this works too');\n\n    Set foreground colors and attributes.\n\n    See \"COLORS AND ATTRIBUTES\" for valid first arguments. Additionally,\n    colors can be specified using their index value:\n\n      my $yellow = fg(220, 'Yellow');\n\n    If the internal $AUTORESET variable is non-zero (default), every element\n    in the list of strings will be wrapped in escape sequences in such a way\n    that the requested attributes will be set before the string and reset to\n    defaults after the string.\n\n    Fall-through attributes can be enabled by setting $AUTORESET to a false\n    value.\n\n      Term::ExtendedColor::autoreset( 0 );\n      my $red   = fg('red1', 'Red');\n      my $green = fg('green1', 'Green');\n\n      print \"Text after $red is red until $green\\n\";\n      print \"Text is still green, \", bold('and now bold as well!');\n\n      # If you exit now without resetting the colors and attributes, chances are\n      # your prompt will be messed up.\n\n      clear(); # All back to normal\n\n    If an invalid attribute is passed, the original data will be returned\n    unmodified.\n\n    If no attribute is passed, thrown an exception.\n\n  bg($color, $string)\n      my $green_bg = bg('green4', 'green background');\n      my @blue_bg  = bg('blue6',  ['blue background']);\n\n    Like \"fg()\", but sets background colors.\n\n  uncolor($string) | uncolour($string)\n      my $stripped = uncolor($colored_data);\n      my @no_color = uncolor(\\@colored);\n      my @no_color = uncolor(@colored);\n\n    Remove all attribute and color escape sequences from the input.\n\n    See uncolor for a command-line utility using this function.\n\n  get_colors() | get_colours()\n      my $colors = get_colors();\n\n    Returns a hash reference with all available attributes and colors.\n\n  clear()\n    When called in scalar context, returns the escape sequence that resets\n    all attributes to their defaults.\n\n    When called in void context, prints it directly.\n\n  autoreset()\n    Turn autoreset on/off. Enabled by default.\n\n      Term::ExtendedColor::autoreset( 0 ); # Turn off autoreset\n\n  bold(\\@data)\n    Convenience function that might be used in place of \"fg('bold',\n    \\@data)\";\n\n    When called without arguments, returns a a string that turns off the\n    bold attribute.\n\n  italic(\\@data)\n    Convenience function that might be used in place of \"fg('italic',\n    \\@data)\";\n\n    When called without arguments, returns a a string that turns off the\n    italics attribute.\n\n  underline(\\@data)\n    Convenience function that might be used in place of \"fg('underline',\n    \\@data)\";\n\n    When called without arguments, returns a a string that turns off the\n    underline attribute.\n\n  inverse(\\@data)\n    Reverse video / inverse. Convenience function that might be used in\n    place of \"fg('inverse', \\@data)\";\n\n    When called without arguments, returns a a string that turns off the\n    inverse attribute.\n\nNOTES\n    The codes generated by this module complies to the extension of the ANSI\n    colors standard first implemented in xterm in 1999. The first 16 color\n    indexes (0 - 15) is the regular ANSI colors, while index 16 - 255 is the\n    extension. Not all terminal emulators support this extension, though\n    I've had a hard time finding one that doesn't. :)\n\n      Terminal    256 colors\n      ----------------------\n      aterm               no\n      eterm              yes\n      gnome-terminal     yes\n      konsole            yes\n      lxterminal         yes\n      mrxvt              yes\n      roxterm            yes\n      rxvt                no\n      rxvt-unicode       yes *\n      sakura             yes\n      terminal           yes\n      terminator         yes\n      vte                yes\n      xterm              yes\n      iTerm2             yes\n      Terminal.app        no\n\n      GNU Screen         yes\n      tmux               yes\n      TTY/VC              no\n\n    * Previously needed a patch. Full support was added in version 9.09.\n\n    There's no way to give these extended colors meaningful names.\n\n    Our first thought was to map them against some standard color names,\n    like those in the HTML 4.0 specification or the SVG one. They didn't\n    match.\n\n    Therefore, they are named by their base color (red, green, magenta) plus\n    index; The first index (always 1) is the brightest shade of that\n    particular color, while the last index is the darkest.\n\n    It's also possible to use some X color names, as defined in \"rgb.txt\".\n    Do note that the color values do not match exactly; it's just an\n    approximation.\n\n    A full list of available colors can be retrieved with \"get_colors()\".\n    See \"COLORS AND ATTRIBUTES\" for full list. All mapped colors can also be\n    retrieved programmatically with \"get_colors()\".\n\nCOLORS AND ATTRIBUTES\n  Attributes\n      reset, clear, normal        reset all attributes\n      bold, bright                bold or bright, depending on implementation\n      faint                       decreased intensity (not widely supported)\n      italic, cursive             italic or cursive\n      underline, underscore       underline\n      blink                       slow blink\n      blink_ms                    rapid blink (only supported in MS DOS)\n      reverse, inverse, negative  reverse video\n      conceal                     conceal, or hide (not widely supported)\n\n  Standard color map\n      FIRST       LAST\n\n      red1        red5\n      blue1       blue17\n      cyan1       cyan24\n      gray1       gray24\n      green1      green28\n      orange1     orange5\n      purple1     purple30\n      yellow1     yellow18\n      magenta1    magenta26\n\n  X color names\n      aquamarine1\n      aquamarine3\n      blueviolet\n      cadetblue1\n      cadetblue2\n      chartreuse1\n      chartreuse2\n      chartreuse3\n      chartreuse4\n      cornflowerblue\n      cornsilk1\n      darkblue\n      darkcyan\n      darkgoldenrod\n      darkgreen\n      darkkhaki\n      darkmagenta1\n      darkmagenta2\n      darkolivegreen1\n      darkolivegreen2\n      darkolivegreen3\n      darkolivegreen4\n      darkolivegreen5\n      darkorange3\n      darkorange4\n      darkorange1\n      darkred1\n      darkred2\n      darkseagreen1\n      darkseagreen2\n      darkseagreen3\n      darkseagreen4\n      darkslategray1\n      darkslategray2\n      darkslategray3\n      darkturquoise\n      darkviolet\n      deeppink1\n      deeppink2\n      deeppink3\n      deeppink4\n      deepskyblue1\n      deepskyblue2\n      deepskyblue3\n      deepskyblue4\n      deepskyblue4\n      dodgerblue1\n      dodgerblue2\n      dodgerblue3\n      gold1\n      gold3\n      greenyellow\n      grey0\n      grey100\n      grey11\n      grey15\n      grey19\n      grey23\n      grey27\n      grey30\n      grey3\n      grey35\n      grey37\n      grey39\n      grey42\n      grey46\n      grey50\n      grey53\n      grey54\n      grey58\n      grey62\n      grey63\n      grey66\n      grey69\n      grey70\n      grey74\n      grey7\n      grey78\n      grey82\n      grey84\n      grey85\n      grey89\n      grey93\n      honeydew2\n      hotpink2\n      hotpink3\n      hotpink\n      indianred1\n      indianred\n      khaki1\n      khaki3\n      lightcoral\n      lightcyan1\n      lightcyan3\n      lightgoldenrod1\n      lightgoldenrod2\n      lightgoldenrod3\n      lightgreen\n      lightpink1\n      lightpink3\n      lightpink4\n      lightsalmon1\n      lightsalmon3\n      lightsalmon3\n      lightseagreen\n      lightskyblue1\n      lightskyblue3\n      lightskyblue3\n      lightslateblue\n      lightslategrey\n      lightsteelblue1\n      lightsteelblue3\n      lightsteelblue\n      lightyellow3\n      mediumorchid1\n      mediumorchid3\n      mediumorchid\n      mediumpurple1\n      mediumpurple2\n      mediumpurple3\n      mediumpurple4\n      mediumpurple\n      mediumspringgreen\n      mediumturquoise\n      mediumvioletred\n      mistyrose1\n      mistyrose3\n      navajowhite1\n      navajowhite3\n      navyblue\n      orangered1\n      orchid1\n      orchid2\n      orchid\n      palegreen1\n      palegreen3\n      paleturquoise1\n      paleturquoise4\n      palevioletred1\n      pink1\n      pink3\n      plum1\n      plum2\n      plum3\n      plum4\n      purple\n      rosybrown\n      royalblue1\n      salmon1\n      sandybrown\n      seagreen1\n      seagreen2\n      seagreen3\n      skyblue1\n      skyblue2\n      skyblue3\n      slateblue1\n      slateblue3\n      springgreen1\n      springgreen2\n      springgreen3\n      springgreen4\n      steelblue1\n      steelblue3\n      steelblue\n      tan\n      thistle1\n      thistle3\n      turquoise2\n      turquoise4\n      violet\n      wheat1\n      wheat4\n\n    In addition, it's also possible to pass raw color;attr strings like so:\n\n        my $foo = fg('48;5;89;38;5;197;1;3;4;7', 'foo');\n\n    Even though the fg() function is used, we set the following attributes:\n\n      background =\u003e 89\n      foreground =\u003e 197\n      bold\n      italic\n      underline\n      reverse\n\nSEE ALSO\n    Term::ExtendedColor::Xresources Term::ExtendedColor::TTY Term::ANSIColor\n\nAUTHOR\n      Magnus Woldrich\n      CPAN ID: WOLDRICH\n      m@japh.se\n      http://github.com/trapd00r\n      http://japh.se\n\nCONTRIBUTORS\n    Varadinsky \u003chttps://github.com/Varadinsky\u003e\n\nCOPYRIGHT\n    Copyright 2010, 2011, 2018, 2019- the Term::ExtendedColor \"AUTHOR\" and\n    \"CONTRIBUTORS\" as listed above.\n\nLICENSE\n    This library is free software; you may redistribute it and/or modify it\n    under the same terms as Perl itself.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrapd00r%2Fterm-extendedcolor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrapd00r%2Fterm-extendedcolor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrapd00r%2Fterm-extendedcolor/lists"}