-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting an idea for default theme engine without termwind
- Loading branch information
1 parent
d41af20
commit 14bc9f2
Showing
5 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Minicli\Framework\Theme\Catalog; | ||
|
||
use Minicli\Framework\Theme\Enums\Background; | ||
use Minicli\Framework\Theme\Enums\Foreground; | ||
use Minicli\Framework\Theme\ThemeContract; | ||
use StringBackedEnum; | ||
|
||
final class DefaultTheme implements ThemeContract | ||
{ | ||
public function default(): array | ||
{ | ||
return [ | ||
Foreground::WHITE, | ||
]; | ||
} | ||
|
||
public function alt(): array | ||
{ | ||
return [ | ||
Foreground::BLACK, | ||
Background::WHITE, | ||
]; | ||
} | ||
|
||
public function error(): array | ||
{ | ||
return [ | ||
Foreground::RED, | ||
]; | ||
} | ||
|
||
public function errorAlt(): array | ||
{ | ||
return [ | ||
Foreground::WHITE, | ||
Background::RED, | ||
]; | ||
} | ||
|
||
public function success(): array | ||
{ | ||
return [ | ||
Foreground::GREEN, | ||
]; | ||
} | ||
|
||
public function successAlt(): array | ||
{ | ||
return [ | ||
Foreground::WHITE, | ||
Background::GREEN, | ||
]; | ||
} | ||
|
||
public function info(): array | ||
{ | ||
return [ | ||
Foreground::CYAN, | ||
]; | ||
} | ||
|
||
public function infoAlt(): array | ||
{ | ||
return [ | ||
Foreground::WHITE, | ||
Background::CYAN, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Minicli\Framework\Theme\Enums; | ||
|
||
enum Background: string | ||
{ | ||
case BLACK = '40'; | ||
case WHITE = '47'; | ||
case RED = '41'; | ||
case GREEN = '42'; | ||
case BLUE = '44'; | ||
case CYAN = '46'; | ||
case MAGENTA = '45'; | ||
case YELLOW = '43'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Minicli\Framework\Theme\Enums; | ||
|
||
enum FontWeight: string | ||
{ | ||
case DEFAULT = '0'; | ||
case BOLD = '1'; | ||
case DIM = '2'; | ||
case ITALIC = '3'; | ||
case UNDERLINE = '4'; | ||
case INVERT = '7'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Minicli\Framework\Theme\Enums; | ||
|
||
enum Foreground: string | ||
{ | ||
case BLACK = '0;30'; | ||
case WHITE = '1;37'; | ||
case RED = '0;31'; | ||
case GREEN = '0;32'; | ||
case BLUE = '1;34'; | ||
case CYAN = '0;36'; | ||
case MAGENTA = '0;35'; | ||
case YELLOW = '0;33'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Minicli\Framework\Theme; | ||
|
||
use StringBackedEnum; | ||
|
||
interface ThemeContract | ||
{ | ||
/** | ||
* Default style | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function default(): array; | ||
|
||
/** | ||
* Alternative style for Default | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function alt(): array; | ||
|
||
/** | ||
* Error style | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function error(): array; | ||
|
||
/** | ||
* Alternative style for Error | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function errorAlt(): array; | ||
|
||
/** | ||
* Success style | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function success(): array; | ||
|
||
/** | ||
* Alternative style for Success | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function successAlt(): array; | ||
|
||
/** | ||
* Info style | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function info(): array; | ||
|
||
/** | ||
* Alternative style for Info | ||
* @return array<int,StringBackedEnum> | ||
*/ | ||
public function infoAlt(): array; | ||
} |