Skip to content

Commit

Permalink
Fix the issue Background color error in dark mode when in box is used #…
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Feb 19, 2024
1 parent 1ce13d3 commit c3e10e0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions framework/library/astroid/Component/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,22 +248,28 @@ public static function colors()
$body_link_color = Style::getColor($params->get('body_link_color', ''));
$body_link_hover_color = Style::getColor($params->get('body_link_hover_color', ''));
$body_heading_color = Style::getColor($params->get('body_heading_color', ''));
$template_layout = $params->get('template_layout', 'wide');
Style::addCssBySelector('html', 'background-color', $body_background_color['light']);
Style::addCssBySelector('[data-bs-theme=dark]', 'background-color', $body_background_color['dark']);

$body = new Style('body');
if ($template_layout == 'boxed') {
$body = new Style('.astroid-layout-boxed .astroid-wrapper');
$body_dark = new Style('.astroid-layout-boxed .astroid-wrapper', 'dark');
} else {
$body = new Style('body');
$body_dark = new Style('body', 'dark');
}
$body->addCss('background-color', $body_background_color['light']);
$body->addCss('color', $body_text_color['light']);
$body->link()->addCss('color', $body_link_color['light']);
$body->link()->hover()->addCss('color', $body_link_hover_color['light']);
$body->link('child', ':not(.btn)')->addCss('color', $body_link_color['light']);
$body->link('child', ':not(.btn)')->hover()->addCss('color', $body_link_hover_color['light']);
$body->render(); // render body colors

$body = new Style('body', 'dark');
$body->addCss('background-color', $body_background_color['dark']);
$body->addCss('color', $body_text_color['dark']);
$body->link('child', ':not(.btn)')->addCss('color', $body_link_color['dark']);
$body->link('child', ':not(.btn)')->hover()->addCss('color', $body_link_hover_color['dark']);
$body->render(); // render body colors
$body_dark->addCss('background-color', $body_background_color['dark']);
$body_dark->addCss('color', $body_text_color['dark']);
$body_dark->link('child', ':not(.btn)')->addCss('color', $body_link_color['dark']);
$body_dark->link('child', ':not(.btn)')->hover()->addCss('color', $body_link_hover_color['dark']);
$body_dark->render(); // render body colors

$body = new Style(['h1','h2','h3','h4','h5','h6']);
$body->addCss('color', $body_heading_color['light']);
Expand Down

1 comment on commit c3e10e0

@Barcenilla00
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works!
Thank you

Please sign in to comment.