added project detail report (#2651)

- avatars via css only
- random colors for entities
- improves print view
- added colors for teams
- added color to tag
This commit is contained in:
Kevin Papst
2021-07-06 22:01:20 +02:00
committed by GitHub
parent cc6031bfde
commit 9ddb87a6fd
122 changed files with 2736 additions and 1549 deletions

View File

@@ -15,6 +15,7 @@ use App\Entity\User;
use App\Event\PageActionsEvent;
use App\Event\ThemeEvent;
use App\Event\ThemeJavascriptTranslationsEvent;
use App\Utils\Color;
use Symfony\Bridge\Twig\AppVariable;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@@ -26,6 +27,10 @@ final class ThemeExtension implements RuntimeExtensionInterface
private $eventDispatcher;
private $translator;
private $configuration;
/**
* @var bool
*/
private $randomColors;
public function __construct(EventDispatcherInterface $dispatcher, TranslatorInterface $translator, SystemConfiguration $configuration)
{
@@ -135,4 +140,25 @@ final class ThemeExtension implements RuntimeExtensionInterface
return $this->configuration->find($name);
}
public function colorize(?string $color, ?string $identifier = null, ?string $fallback = null): string
{
if ($color !== null) {
return $color;
}
if ($this->randomColors === null) {
$this->randomColors = $this->configuration->isThemeRandomColors();
}
if ($this->randomColors) {
return (new Color())->getRandom($identifier);
}
if ($fallback !== null) {
return $fallback;
}
return Constants::DEFAULT_COLOR;
}
}