<?php

namespace App\View\Traits;

use App\View\Enums\Variant;

trait HasColors
{
    public function bgColor(string $variant): string
    {
        $variant = Variant::fromString($variant);

        return implode(' ', [
            $variant->background(),
            $variant->hoverBackground(),
        ]);
    }

    public function fgColor(string $variant): string
    {
        $variant = Variant::fromString($variant);

        return implode(' ', [
            $variant->foreground(),
            $variant->hoverForeground(),
        ]);
    }

    public function allColors(string $variant): string
    {
        return "{$this->bgColor($variant)} {$this->fgColor($variant)}";
    }
}
