1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Change progressbar shading

This commit is contained in:
Brown 2019-05-31 11:55:47 -04:00
parent a060da95bf
commit 543ae4074c

View File

@ -49,11 +49,12 @@ class DefaultProgress extends LongProgress
// The left-most characters are "Light shade"
$progress_bar = str_repeat("\u{2588}", $current);
$delta = $current_float - $current;
if ($delta > 1.0 / 3) {
// The between character is "Full block" or "Medium shade" or "solid shade".
// The remaining characters on the right are "Full block" (darkest)
$first = $delta > 2.0 / 3 ? "\u{2593}" : "\u{2592}";
$progress_bar .= $first . str_repeat("\u{2591}", $rest - 1);
if ($delta > 3.0 / 4) {
$progress_bar .= "\u{258A}" . str_repeat("\u{2591}", $rest - 1);
} elseif ($delta > 2.0 / 4) {
$progress_bar .= "\u{258C}" . str_repeat("\u{2591}", $rest - 1);
} elseif ($delta > 1.0 / 4) {
$progress_bar .= "\u{258E}" . str_repeat("\u{2591}", $rest - 1);
} else {
$progress_bar .= str_repeat("\u{2591}", $rest);
}