core icon indicating copy to clipboard operation
core copied to clipboard

New Dashboard - How to change canvas text color for other themes?

Open opnsenseuser opened this issue 1 year ago • 20 comments

Hi Stephan

I wanted to ask you in which file I can change the text colors for the canvas charts? And how can I then overwrite these for my themes?

Thanks Regards, Rene (team-rebellion)

Our forum is located at https://forum.opnsense.org , please consider joining discussions there in stead of using GitHub for these matters.

Before you ask a new question, we ask you kindly to acknowledge the following:

  • [x ] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
  • [x ] I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue

opnsenseuser avatar May 27 '24 11:05 opnsenseuser

Hey there :)

I've committed https://github.com/opnsense/core/commit/e4635872fc6e306a010f6d9112935f42ec6489d5 as a possible strategy. You can then do the following in the CSS file:

:root {
    --chart-js-background-color: #f7e2d6;
    --chart-js-border-color: #d94f00;
    --chart-js-font-color: #d94f00;
}

Some of the text in the charts is placed with a custom plugin, I'll investigate inheriting the defaults from the Chart global there.

swhite2 avatar May 27 '24 13:05 swhite2

thx - works great. what i´m missing is to change the black color for this grafik

opnsenseuser avatar May 28 '24 05:05 opnsenseuser

So in this case, the text (number) of the %.

opnsenseuser avatar May 28 '24 06:05 opnsenseuser

@opnsenseuser Should work with https://github.com/opnsense/core/commit/b74baecf135c45ebdecfeac3bcdb6f42a114763c. This will adapt to the chart font color, if you'd like it to be configurable separately let me know.

swhite2 avatar May 28 '24 13:05 swhite2

@swhite2 perfect ! How can i use this with css to change the color?

opnsenseuser avatar May 28 '24 14:05 opnsenseuser

@opnsenseuser The text in those gauge widgets should adapt to the same --chart-js-font-color value globally.

swhite2 avatar May 28 '24 15:05 swhite2

@swhite2 sorry, it seems like this doesnt work. grafik

opnsenseuser avatar May 28 '24 15:05 opnsenseuser

i also allready patched the core code dooing >> opnsense-patch -c core b74baec

opnsenseuser avatar May 28 '24 15:05 opnsenseuser

Works without issue on my end

image

Based on the screenshot (memory usage should show secondary text as well) you're likely behind the master branch, in which case the patch may have failed to apply properly. Be sure to try a different browser as well to rule out caching issues.

Edit: The gauge widgets specifically have been refactored into a base class, given that you're missing these commits it's likely best if you make upgrade in your local repo clone

swhite2 avatar May 28 '24 15:05 swhite2

ok, maybe its an caching problem.

opnsenseuser avatar May 28 '24 15:05 opnsenseuser

@swhite2 you are right. file is missing even after upgrade of repo grafik

opnsenseuser avatar May 28 '24 15:05 opnsenseuser

@opnsenseuser Just pull the latest core repository and make upgrade, I assume you're not editing anything there.

The dashboard is still under development, so things will change in the meantime - be sure to upgrade when you want to work on the theme.

swhite2 avatar May 28 '24 16:05 swhite2

everything works great....one more text i found. is it possible to change this text color too?

grafik

opnsenseuser avatar May 29 '24 23:05 opnsenseuser

https://github.com/opnsense/core/commit/9b55214aaa16ac8c76c389408438be9e4cfbab11 should do it.

Appreciate the work on the theme :)

swhite2 avatar May 30 '24 06:05 swhite2

@swhite2 perfect. works great grafik

opnsenseuser avatar May 30 '24 07:05 opnsenseuser

@swhite2 do we need this hover effect on the right side if you hover any widget? on opnsense this is not shown because of the white color of the widgets grafik

opnsenseuser avatar May 30 '24 07:05 opnsenseuser

what element class/id is the hover effect? Seems to be something internal to gridstack

swhite2 avatar May 30 '24 07:05 swhite2

should be any of these classes grafik

opnsenseuser avatar May 30 '24 08:05 opnsenseuser

Cannot reproduce this, I think it's best if I take a look as soon as I'm able to check out an initial version of your changes

swhite2 avatar May 30 '24 09:05 swhite2

@swhite2 Maybe the color can be set here >> gridstack-all.min.js but in the online manual its really dificult to find the problem. i only found the resize sample https://gridstackjs.com/demo/sizeToContent.html

grafik

opnsenseuser avatar May 30 '24 13:05 opnsenseuser