leandrocfe / filament-apex-charts

Apex Charts integration for Filament PHP.
https://filament-apex-charts-demo.leandroferreira.dev.br
MIT License
286 stars 36 forks source link

Problem in light mode #28

Closed gotzsys closed 11 months ago

gotzsys commented 1 year ago

When I change from dark to light mode, the colors are set correctly. image

However, when I refresh the page, this problem occurs. image

andrewdwallo commented 1 year ago

Can confirm that this does happen sometimes. I tried to use the "title" option and the same thing happened. I have to switch from dark back to light mode many times for the black text to show instead of white.

valpuia commented 1 year ago

Check this out.. I submit issue but found a solution

https://github.com/leandrocfe/filament-apex-charts/issues/25#issuecomment-1574629367

andrewdwallo commented 1 year ago

It's not really a solution though. #9ca3af is essentially the only color that you can use for legend labels, etc... only because the color looks okay in both light and dark. I think it would be a lot better if dark mode was actually supported with chart text, but I'm not sure how that would be done unless the package owner decided to override something from apex charts.

andrewdwallo commented 1 year ago

So, in my opinion, it may not be an issue, but I think it is definitely a flaw...

gotzsys commented 1 year ago

The problem is here... /resources/views/widgets/components/chart.blade.php

image

localStorage.getItem('theme') || (document.documentElement.classList.contains('dark') ? 'dark' : 'light')
andrewdwallo commented 1 year ago

I'm not sure if that is the actual issue but I actually found a solution by overriding the CSS class of whatever I am trying to use in filament.css like this:

.apexcharts-title-text {
    fill: #111827;
}

.dark .apexcharts-title-text {
    fill: #ffffff;
}

This actually looks promising to me for many things considering the CSS of almost everything in apex charts is not influenced by TailwindCSS at all.

gotzsys commented 1 year ago

Theme set to dark mode image

image

Theme changed to light mode. image image

@leandrocfe, procede?

leandrocfe commented 1 year ago

Theme set to dark mode image

image

Theme changed to light mode. image image

@leandrocfe, procede?

Sim, eu vou remover e deixar somente pela classe. Tenho umas melhorias pra lançar junto com isso. Acho que até a próxima semana 👍

gotzsys commented 1 year ago

Boa, muito obrigado @leandrocfe ! Abraço e bom final de semana

leandrocfe commented 1 year ago

Boa, muito obrigado @leandrocfe ! Abraço e bom final de semana

Valeu. Bom fim de semana

leandrocfe commented 1 year ago

Hi @gotzsys, Would you like to try this version?

composer require leandrocfe/filament-apex-charts:"^2.0"
gotzsys commented 11 months ago

Hi @leandrocfe, sorry for the late reply, the adjustment worked out well, thank you very much!