Skip to content

Commit 11def33

Browse files
committed
feature: add Palette enum
1 parent f1d344d commit 11def33

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/Palette.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
namespace Gt\Cli;
3+
4+
enum Palette:int {
5+
case BLACK = 0;
6+
case RED = 1;
7+
case GREEN = 2;
8+
case YELLOW = 3;
9+
case BLUE = 4;
10+
case MAGENTA = 5;
11+
case CYAN = 6;
12+
case WHITE = 7;
13+
14+
public function getForegroundCode():string {
15+
return (string)(30 + $this->value);
16+
}
17+
18+
public function getBackgroundCode():string {
19+
return (string)(40 + $this->value);
20+
}
21+
}

0 commit comments

Comments
 (0)