filamentphp/filament · error · LogicException

A `darkSurface()` must be configured before calling `get()`.

Error message

A `darkSurface()` must be configured before calling `get()`.

What it means

Error "A `darkSurface()` must be configured before calling `get()`." thrown in filamentphp/filament.

Source

Thrown at packages/support/src/View/Components/ColorMaps/IconButtonComponentColorMap.php:81

    public function darkMaxShade(int $shade): static
    {
        $this->darkMaxShade = $shade;

        return $this;
    }

    /**
     * @return array<string, int>
     */
    public function get(): array
    {
        if ($this->lightSurface === null) {
            throw new LogicException('A `lightSurface()` must be configured before calling `get()`.');
        }

        if ($this->darkSurface === null) {
            throw new LogicException('A `darkSurface()` must be configured before calling `get()`.');
        }

        $lightShade = Color::findShade(
            palette: $this->palette,
            surface: $this->lightSurface,
            minRatio: $this->minContrastRatio,
        );

        if ($lightShade === null) {
            $text = 900;
            $hoverText = 800;
        } elseif ($lightShade > 500) {
            // Shades above 500 are likely to be quite dark, so instead of lightening the icon
            // when it is hovered, we darken it.
            $text = $lightShade;
            $hoverText = $lightShade + 100;
        } else {
            $text = $lightShade + 100;

View on GitHub (pinned to 53483fa934)

When it happens

Trigger: Thrown at packages/support/src/View/Components/ColorMaps/IconButtonComponentColorMap.php:81 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/bbb9ed4d9090a52c. Report an issue: GitHub.