feat: update CSS theming and enhance variable application for improved UI consistency
- Refactored CSS styles to utilize HSL color values for better theme adaptability. - Added custom light and dark themes with comprehensive variable definitions to ensure consistent styling across the application. - Implemented a mechanism to force CSS variable updates, ensuring that custom themes are applied correctly during runtime.
This commit is contained in:
@@ -171,6 +171,14 @@ export function aplicarTema(temaId: TemaId | string | null | undefined): void {
|
||||
// Forçar reflow para garantir que o CSS seja aplicado
|
||||
void htmlElement.offsetHeight;
|
||||
|
||||
// Forçar atualização de todas as variáveis CSS
|
||||
// Isso garante que os temas customizados sejam aplicados corretamente
|
||||
if (typeof window !== 'undefined' && window.getComputedStyle) {
|
||||
const computedStyle = window.getComputedStyle(htmlElement);
|
||||
// Forçar recálculo das variáveis CSS
|
||||
computedStyle.getPropertyValue('--p');
|
||||
}
|
||||
|
||||
// Disparar evento customizado para notificar mudança de tema
|
||||
if (typeof window !== 'undefined') {
|
||||
window.dispatchEvent(new CustomEvent('themechange', { detail: { theme: nomeDaisyUI } }));
|
||||
|
||||
Reference in New Issue
Block a user