private function createConditionsForPalette(PaletteInterface $palette, array $typeLegends)
    {
        $conditions = [];

        foreach ($typeLegends as $value => $legends) {
            // We use an immutable implementation. Using the same condition is save here.
            $valueCondition = new FilterSettingTypeSubPaletteCondition($this->filterFactory, $value);

            foreach ($legends as $legendName => $legendProperties) {
                $legend = $this->getLegend($palette, $legendName);

                foreach ($legendProperties as $propertyName) {
                    $this
                        ->getConditionChain($legend, $propertyName, $conditions)
                        ->addCondition($valueCondition);
                }
            }
        }
    }