<?php
require_once __DIR__ . '/theme-init.php';

header('Content-Type: application/json; charset=UTF-8');

if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    echo json_encode([
        'success' => false,
        'message' => 'Metodo nao permitido.',
    ]);
    exit;
}

// O theme-init.php já processou os POSTs de novacor e novabgcor
// e atualizou $_SESSION['theme_palette'] — basta devolver a paleta atual
echo json_encode([
    'success' => true,
    'palette' => $_SESSION['theme_palette'],
]);
