-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattributes.php
More file actions
34 lines (28 loc) · 785 Bytes
/
attributes.php
File metadata and controls
34 lines (28 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Macocci7\BashColorizer\Enums\Attribute;
use Macocci7\BashColorizer\Enums\Foreground;
use Macocci7\BashColorizer\Colorizer;
$colors = [
...array_filter(
Foreground::values(),
function ($v, $k) {
return ! in_array($k, [0, 8, 9]);
},
ARRAY_FILTER_USE_BOTH
)
];
$n = count($colors);
Colorizer::background('blue')
->echo(' Available Attributes ', PHP_EOL);
Colorizer::attributes(['reset'])
->background('default');
foreach (Attribute::values() as $i => $a) {
echo sprintf(
"%2d: %s",
$i + 1,
Colorizer::foreground($colors[$i % $n])
->attributes([$a]) // this aplies the attribute
->encode($a, PHP_EOL)
);
}