Skip to content

Commit fa2a8fd

Browse files
committed
style: follow Pint conventions in terminal lane colors
Place static helpers before instance methods and use multibyte string operations.
1 parent b4aefad commit fa2a8fd

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

‎app/Services/Terminal/TerminalRenderer.php‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ public static function sanitize(string $text): string
5151
return (string) preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/', '', $stripped);
5252
}
5353

54+
/**
55+
* Returns the RGB components of one of the six preset lanes or a custom hex lane.
56+
*
57+
* @return array{int, int, int}
58+
*/
59+
public static function laneRgb(int|string $lane): array
60+
{
61+
if (is_int($lane)) {
62+
return self::LANES[$lane] ?? self::LANES[0];
63+
}
64+
65+
return [
66+
(int) hexdec(mb_substr($lane, 1, 2)),
67+
(int) hexdec(mb_substr($lane, 3, 2)),
68+
(int) hexdec(mb_substr($lane, 5, 2)),
69+
];
70+
}
71+
5472
/**
5573
* Renders the ASCII art banner.
5674
*/
@@ -247,24 +265,6 @@ public function footer(bool $color = true): string
247265
]);
248266
}
249267

250-
/**
251-
* Returns the RGB components of one of the six preset lanes or a custom hex lane.
252-
*
253-
* @return array{int, int, int}
254-
*/
255-
public static function laneRgb(int|string $lane): array
256-
{
257-
if (is_int($lane)) {
258-
return self::LANES[$lane] ?? self::LANES[0];
259-
}
260-
261-
return [
262-
(int) hexdec(substr($lane, 1, 2)),
263-
(int) hexdec(substr($lane, 3, 2)),
264-
(int) hexdec(substr($lane, 5, 2)),
265-
];
266-
}
267-
268268
/**
269269
* Resolves the ANSI escape sequence for a user lane (24-bit TrueColor or 16-color ANSI).
270270
*/

0 commit comments

Comments
 (0)