Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6068865
AnsiTermColorer.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
828 B
Referenced Files
None
Subscribers
None
AnsiTermColorer.php
View Options
<?php
/**
* @license GPL-2.0-or-later
* @file
*/
namespace
MediaWiki\Tests
;
/**
* Terminal that supports ANSI escape sequences.
*
* @ingroup Testing
*/
class
AnsiTermColorer
{
/**
* Return ANSI terminal escape code for changing text attribs/color
*
* @param string|int $color Semicolon-separated list of attribute/color codes, e.g. 4 for
* underline, 30 to 37 for 3-bit foreground colors
* @return string
*/
public
function
color
(
string
|
int
$color
):
string
{
global
$wgCommandLineDarkBg
;
// 1 for increased intensity, 0 to reset all previous attributes
return
"
\x
1b["
.
(
$wgCommandLineDarkBg
?
'1'
:
'0'
)
.
";{$color}m"
;
}
/**
* Return ANSI terminal escape code for restoring default text attributes
*
* @return string
*/
public
function
reset
():
string
{
return
"
\x
1b[0m"
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 5 2026, 05:47 (6 w, 11 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a2/1d/8119071b4e2ab4b53cbb6e4380d5
Default Alt Text
AnsiTermColorer.php (828 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment