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.
In this Pull Request (PR), I would like to introduce a new feature to this repository that enables exporting the colour palette to CSS variables format. In my opinion, it's useful functionality and may reduce the time spent on copying and pasting all colours from the generator to CSS.
Changes introduced in the Pull Request (PR):
CSS Variable Export Function:
I added a new function called convertJSONtoCSS that converts the color palette from JSON format into CSS variables. This function processes each color and its shades, creating corresponding CSS variables. For each color, a variable is created in the format --clr-{colorName}-{shadeLabel}: {colorValue};, and a main variable for that color is also defined.
Example:
For the 'Primary' color, we obtain the defined CSS variables:
No changes to the color format:
The function currently accepts the color palette in HEX format, maintaining consistency with the existing application code.
Testing:
I conducted tests for the convertJSONtoCSS function and ensured that it correctly generates CSS variables for each color and its shades from the JSON-format palette. The tests were successful, and the function behaves as expected.
Impact on existing code:
The introduced changes do not negatively impact the existing code. The new function has been seamlessly integrated with the existing components and adapted to the current application logic.
How it works in practice? User can export palette and select what type of export would get.