From fade913fa9d607706369231ab6ecbc63619d46a1 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 3 Jul 2026 20:58:09 -0300 Subject: [PATCH] =?UTF-8?q?Fix=20Scss:=20injetar=20cores=20hex=20como=20co?= =?UTF-8?q?r=20SCSS,=20n=C3=A3o=20string=20com=20aspas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ValueConverter::fromPhp('#0b0e1a') gera SassString com aspas, e 'background-color:"#0b0e1a"' é CSS inválido (browser ignora — fundo cinza). Bug latente desde os temas legados (afetava qualquer uso direto de $var injetada, ex. cor do botão); ficou visível quando os fundos passaram a usar $page-background-color. Hex agora entra via parseValue() como cor de verdade — também habilita funções de cor sobre as variáveis. Co-Authored-By: Claude Fable 5 --- src/Scss.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Scss.php b/src/Scss.php index d3b2a77..816ae55 100644 --- a/src/Scss.php +++ b/src/Scss.php @@ -19,7 +19,13 @@ class Scss { if (!empty($variables)) { $convertedVariables = []; foreach ($variables as $key => $value) { - $convertedVariables[$key] = \ScssPhp\ScssPhp\ValueConverter::fromPhp($value); + if (is_string($value) && preg_match('/^#[0-9a-fA-F]{3,8}$/', $value)) { + // Cores hex precisam entrar como cor SCSS de verdade: fromPhp() + // gera string com aspas ("#0b0e1a"), que é CSS inválido + $convertedVariables[$key] = \ScssPhp\ScssPhp\ValueConverter::parseValue($value); + } else { + $convertedVariables[$key] = \ScssPhp\ScssPhp\ValueConverter::fromPhp($value); + } } $scss->addVariables($convertedVariables); }