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.
With all core palettes now being loaded at all times with their application depending on the
data-glpi-theme
attribute on the root element, it is easy to automatically generate a palette preview "image" for each palette rather than relying on a png file existing for the palette and pulling them all over the network.GLPI WILL still fall back to trying to load a PNG in a "previews" subfolder where the theme exists. However, if a palette CSS defines 4 palette color properties
--glpi-palette-color-n
, we will simply use those colors.After migrating all of the core palettes, it seemed like the loading performance of the palette dropdown improved rather than decreased.
This PR also enables automatic loading of custom palettes. When users create custom palettes they need to follow these rules:
:root[data-glpi-theme="palette_name"] {
wherepalette_name
matches the scss file name without the extension.Inside the root selector they can declare their css property overrides and, if they choose, declare the
--glpi-palette-color-n
properties if they want a preview but don't want to create a png image for it.