Proposal: Use CSS variables in Statistics charts for colour customisation #4103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following our discussion in #4070, I actually found a way to restore some theme customisation at the JS level, and here is an implementation suggestion.
That only covers the Google Charts, as the Fan chart is generated at the PHP level.
There are quite a few file changes, but basically the main components are:
ColorService
from PHP to JS (in the webtrees.colors namespace): the methods have been JS-ify without change to their logic, and a new method has been introduced that convert an array of "colours definition" to actual colours. The elements can be fixed colours, or a 2-elements array with a CSS variable and a fall-back colour.I have "restored" in CSS the parameters that were different from the hardcoded default for the standard themes.
I know that this may only be a temporary need, if the Google Charts are refactored with another library at some point, but the logic may prove useful even with a future library for theming.
This is just a proposal; there are few implementation details than can be discussed, and as I mentioned in the issue, I can live as well without colour customisation until a new library is implemented