Download the PHP package macocci7/bash-colorizer without Composer
On this page you can find all versions of the php package macocci7/bash-colorizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macocci7/bash-colorizer
More information about macocci7/bash-colorizer
Files in macocci7/bash-colorizer
Package bash-colorizer
Short Description Let's make your bash terminal full of colors!
License MIT
Informations about the package bash-colorizer
BASH COLORIZER
1. Features
Bash Colorizer
outputs strings in specified colors and attributes.
Let's make your bash
terminal full of colors!
2. Contents
- 1. Features
- 2. Contents
- 3. Verified Terminals
- 4. Requirements
- 5. Installation
- 6. Usage
- 6.1. Basic Usage
- 6.2. Available Attributes
- 6.3. Available Colors
- 7. Examples
- 8. LICENSE
3. Verified Terminals
- VSCode Terminal (VSCode 1.99.1 / Windows 11)
- Windows Terminal 1.22.10731.0
4. Requirements
- PHP 8.1 or later installed
- Composer v2 installed
- Bash v5 installed
5. Installation
6. Usage
6.1. Basic Usage
-
Import composer's
autoload.php
at first. -
Displaying messages:
static calls:
method chains:
creating an instance:
-
Configuration:
static call:
method chain:
creating an instance:
-
Setting attributes:
See more: Available Attributes
-
Setting foreground color:
by name:
by hex code:
by number [0 - 255] (256 colors):
by (RGB) array (24bit 16777216 colors):
See more: Available Colors
-
Setting background color:
by name:
by hex code:
by number [0 - 255] (256 colors):
by (RGB) array (24bit 16777216 colors):
See more: Available Colors
-
Equivalent to
config()
: -
Setting underline color:
by hex code:
by number [0 - 255] (256 colors):
by (RGB) array (24bit 16777216 colors):
See more: Available Colors
-
Returning colorized string:
As an argument of echo:
This is also effective:
-
Returning human readable encoded string:
This code outputs the following string:
Running bash command
echo
with-e
option on this string takes colorizing effect:
6.2. Available Attributes
Attribute | VSCode Terminal | Windows Terminal |
---|---|---|
reset |
〇 | 〇 |
bold |
〇 | ❌ |
faint |
〇 | 〇 |
italic |
〇 | 〇 |
underline |
〇 | 〇 |
blink |
❌ | ▲ *1 |
fast-blink |
❌ | ▲ 2 |
reverse |
〇 | 〇 |
conceal |
〇 | 〇 |
strike |
〇 | 〇 |
gothic |
❌ | ❌ |
double-underline |
〇 | 〇 |
normal |
〇 | 〇 |
no-italic |
〇 | 〇 |
no-underline |
〇 | 〇 |
no-blink |
ー *3 |
〇 *4 |
proportional-spacing |
ー | ー |
no-reverse |
〇 | 〇 |
no-conceal |
〇 | 〇 |
no-strike |
〇 | 〇 |
no-proportional-spacing |
ー | ー |
framed |
❌ | ❌ |
encircled |
❌ | ❌ |
overlined |
〇 | 〇 |
no-framed-no-encircled |
ー *3 |
ー *3 |
no-overlined |
〇 | 〇 |
underline-color |
〇 | ▲ *5 |
1: No effect with
faint
2: Notfast
(blinks at the same rate asblink
)
3: Unknown because the corresponding attribute has no effect
4: Also effective againstfast-blink
*5: Partially effective
e.g.) on VSCode Terminal (theme:Dark Modern
)
See more: Select Graphic Rendition parameters | ANSI escape code | Wikipedia
6.3. Available Colors
-
foreground
/background
color names:black
red
green
yellow
blue
magenta
cyan
white
(no effect, only name)extended
default
e.g.) on VSCode Terminal (theme: Dark Modern
)Foregound Colors Background Colors -
256 colors [ 0 - 255 ]:
foreground
/background
/underline
e.g.) foreground colors on VSCode Terminal (theme:
Dark Modern
):e.g.) background colors on VSCode Terminal (theme:
Dark Modern
):e.g.) underline colors on VSCode Terminal (theme:
Dark Modern
): -
24bit (16777216) colors:
e.g.) foreground colors on VSCode Terminal (theme:
Dark Modern
):e.g.) background colors on VSCode Terminal (theme:
Dark Modern
):e.g.) underline colors on VSCode Terminal (theme:
Dark Modern
):
7. Examples
Example codes are in playground directory.
- colorizer.php
- attributes.php
- foreground.php
- background.php
- foreground_256colors.php
- foreground_24bitcolors.php
- background_256colors.php
- background_24bitcolors.php
- underline_256colors.php
- underline_24bitcolors.php
- readable.php
- converter.php
8. LICENSE
MIT
Copyright 2025 macocci7.