Skip to content

Commit 81ab6e5

Browse files
committed
row colours
1 parent 9d9a8af commit 81ab6e5

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

‎src/Nether/Console/Elements/Table.php‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ class Table
3636
public Common\Datastore
3737
$Show;
3838

39+
#[Common\Meta\PropertyObjectify]
40+
public Common\Datastore
41+
$Styles;
42+
3943
public string
4044
$BorderCharH = '═';
4145

@@ -85,6 +89,15 @@ public function
8589
return $this;
8690
}
8791

92+
public function
93+
SetStyles(iterable $Styles):
94+
static {
95+
96+
$this->Styles->Import($Styles);
97+
98+
return $this;
99+
}
100+
88101
public function
89102
Push(...$Args):
90103
static {
@@ -253,7 +266,7 @@ public function
253266
$Format = sprintf(
254267
'%s %s%s ',
255268
$this->Client->Format($BC, C: $this->BorderColour),
256-
$Value,
269+
$this->Client->Format($Value, C: $this->Styles->Get($Loop)),
257270
str_repeat(' ', max(0, ($this->Widths[$Key] - $Len)) )
258271
);
259272

@@ -342,6 +355,7 @@ static public function
342355
Console\Client $Client,
343356
?iterable $Headers=NULL,
344357
?iterable $Rows=NULL,
358+
?iterable $Styles=NULL,
345359
?Dye\Colour $BorderColour=NULL,
346360
?Dye\Colour $HeaderColour=NULL,
347361
?Dye\Colour $TextColour=NULL,
@@ -362,6 +376,9 @@ static public function
362376
if($Rows)
363377
$Output->SetData($Rows);
364378

379+
if($Styles)
380+
$Output->SetStyles($Styles);
381+
365382
////////
366383

367384
if($Print > 0)

0 commit comments

Comments
 (0)