public function createPaletteCondition($paletteSelector, array $selectorFieldNames)
    {
        if ('default' === $paletteSelector) {
            return new DefaultPaletteCondition();
        }

        // Legacy fallback, try to split on $selectors with optimistic suggestion of values.
        if (false === \strpos($paletteSelector, '|')) {
            foreach ($selectorFieldNames as $selectorFieldName) {
                $paletteSelector = \str_replace(
                    $selectorFieldName,
                    '|' . $selectorFieldName . '|',
                    $paletteSelector
                );
            }
        }

        // Extended mode, split selectors and values with "|".
        $paletteSelectorParts = \explode('|', $paletteSelector);
        $paletteSelectorParts = \array_map('trim', $paletteSelectorParts);
        $paletteSelectorParts = \array_filter($paletteSelectorParts);

        $condition = new PaletteConditionChain();

        foreach ($paletteSelectorParts as $paletteSelectorPart) {
            // The part is a property name (checkbox like selector).
            if (\in_array($paletteSelectorPart, $selectorFieldNames)) {
                $condition->addCondition(
                    new PalettePropertyTrueCondition($paletteSelectorPart)
                );
                continue;
            }

            // The part is a value (but which?) (select box like selector).
            $orCondition = new PaletteConditionChain([], PaletteConditionChain::OR_CONJUNCTION);

            foreach ($selectorFieldNames as $selectorFieldName) {
                $orCondition->addCondition(
                    new PalettePropertyValueCondition(
                        $selectorFieldName,
                        $paletteSelectorPart,
                        true
                    )
                );
            }

            $condition->addCondition($orCondition);
        }

        return $condition;
    }