Skip to content

Commit 37dcf77

Browse files
committed
improved tree colors
1 parent 3ddd313 commit 37dcf77

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/Plugin.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -408,31 +408,18 @@ protected function showDepsTree()
408408
return;
409409
}
410410

411-
$this->initStyles();
412411
foreach (array_reverse($this->orderedList) as $name => $depth) {
413412
$deps = $this->originalFiles[$name];
414-
$color = $this->colors[$depth];
413+
$color = $this->colors[$depth % count($this->colors)];
415414
$indent = str_repeat(' ', $depth - 1);
416415
$package = $this->plainList[$name];
417-
$showdeps = $deps ? '[' . implode(',', array_keys($deps)) . ']' : '';
418-
$this->io->write(sprintf('%s - <%s>%s</%s> %s %s', $indent, $color, $name, $color, $package->getFullPrettyVersion(), $showdeps));
416+
$showdeps = $deps ? '<comment>[' . implode(',', array_keys($deps)) . ']</>' : '';
417+
$this->io->write(sprintf('%s - <fg=%s;options=bold>%s</> %s %s', $indent, $color, $name, $package->getFullPrettyVersion(), $showdeps));
419418
}
420419
}
421420

422421
protected $colors = ['red', 'green', 'yellow', 'cyan', 'magenta', 'blue'];
423422

424-
protected function initStyles()
425-
{
426-
$ref = new \ReflectionProperty(get_class($this->io), 'output');
427-
$ref->setAccessible(true);
428-
$output = $ref->getValue($this->io);
429-
430-
foreach ($this->colors as $color) {
431-
$style = new OutputFormatterStyle($color);
432-
$output->getFormatter()->setStyle($color, $style);
433-
}
434-
}
435-
436423
/**
437424
* Get absolute path to package base dir.
438425
* @return string

0 commit comments

Comments
 (0)