app/Module/ColorsTheme.php
public function menuPalette(): Menu
    {
        $request = app(ServerRequestInterface::class);

        /* I18N: A colour scheme */
        $menu = new Menu(I18N::translate('Palette'), '#', 'menu-color');

        foreach ($this->palettes() as $palette_id => $palette_name) {
            $url = (string) $request->getUri();
            $url = preg_replace('/&themecolor=[a-z]+/', '', $url);
            $url .= '&themecolor=' . $palette_id;

            $menu->addSubmenu(new Menu(
                $palette_name,
                '#',
                'menu-color-' . $palette_id . ($this->palette() === $palette_id ? ' active' : ''),
                [
                    'onclick' => 'document.location=\'' . $url . '\'',
                ]
            ));
        }

        return $menu;
    }
public function menuPalette(): Menu
    {
        $request = app(ServerRequestInterface::class);

        /* I18N: A colour scheme */
        $menu = new Menu(I18N::translate('Palette'), '#', 'menu-color');

        foreach ($this->palettes() as $palette_id => $palette_name) {
            $url = (string) $request->getUri();
            $url = preg_replace('/&themecolor=[a-z]+/', '', $url);
            $url .= '&themecolor=' . $palette_id;

            $menu->addSubmenu(new Menu(
                $palette_name,
                '#',
                'menu-color-' . $palette_id . ($this->palette() === $palette_id ? ' active' : ''),
                [
                    'onclick' => 'document.location=\'' . $url . '\'',
                ]
            ));
        }

        return $menu;
    }
public function menuPalette ( ) : Menu { $ request = app ( ServerRequestInterface :: class ) ; /* I18N: A colour scheme */ $ menu = new Menu ( I18N :: translate ( 'Palette' ) , '#' , 'menu-color' ) ; foreach ( $ this -> palettes ( ) as $ palette_id => $ palette_name ) { $ url = ( string ) $ request -> getUri ( ) ; $ url = preg_replace ( '/&themecolor=[a-z]+/' , '' , $ url ) ; $ url .= '&themecolor=' . $ palette_id ; $ menu -> addSubmenu ( new Menu ( $ palette_name , '#' , 'menu-color-' . $ palette_id . ( $ this -> palette ( ) === $ palette_id ? ' active' : '' ) , [ 'onclick' => 'document.location=\'' . $ url . '\'' , ] ) ) ; } return $ menu ; }
Create a menu of palette options

@return Menu
Create a menu of palette options