filamentphp/filament · error · LogicException

At least one `lightBackground()` candidate must be configure

Error message

At least one `lightBackground()` candidate must be configured before calling `get()`.

What it means

Error "At least one `lightBackground()` candidate must be configured before calling `get()`." thrown in filamentphp/filament.

Source

Thrown at packages/support/src/View/Components/ColorMaps/ButtonComponentColorMap.php:88

    /**
     * Add a candidate `(bg, hover, alternateHover?)` triplet for dark mode. Each call appends
     * a candidate; the resolver evaluates them in the order added using the same two-pass
     * algorithm as `lightBackground()`.
     */
    public function darkBackground(int $bg, int $hover, ?int $alternateHover = null): static
    {
        $this->darkBackgrounds[] = ['bg' => $bg, 'hover' => $hover, 'alternateHover' => $alternateHover];

        return $this;
    }

    /**
     * @return array<string, int>
     */
    public function get(): array
    {
        if (empty($this->lightBackgrounds)) {
            throw new LogicException('At least one `lightBackground()` candidate must be configured before calling `get()`.');
        }

        if (empty($this->darkBackgrounds)) {
            throw new LogicException('At least one `darkBackground()` candidate must be configured before calling `get()`.');
        }

        $textForBg = $this->resolveTextForEachBackground();

        $textLightness = $this->probeTextLightness($textForBg);

        [$bg, $hoverBg] = $this->pickBackgroundShades($textLightness, $this->lightBackgrounds);
        [$darkBg, $darkHoverBg] = $this->pickBackgroundShades($textLightness, $this->darkBackgrounds);

        return [
            'bg' => $bg,
            'hover:bg' => $hoverBg,
            'dark:bg' => $darkBg,
            'dark:hover:bg' => $darkHoverBg,

View on GitHub (pinned to 53483fa934)

When it happens

Trigger: Thrown at packages/support/src/View/Components/ColorMaps/ButtonComponentColorMap.php:88 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/9ed54f729b12f5ca. Report an issue: GitHub.