SLOP-27: Fix CSS formatter output for empty palette#1
Open
Conversation
- colormaestro/formatters/css.py: return minimal ':root {}' when palette is
empty instead of appending semantic block with undefined variables.
- tests/test_generators.py: use dark_mode=True for ui_palette.generate().
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Jira
SLOP-27
Summary
When
css.generate([])is called with an empty palette, the formatter still appends the "Semantic color mapping" block that references--color-primary,--color-secondary,--color-primary-rgb, and--color-accent. Those variables are never defined for an empty palette, so the output is invalid CSS.Changes
paletteis empty, return":root {\n}\n"immediately and do not add the semantic block or dark-mode block.dark_mode=Trueinstead ofdark=Truewhen callingui_palette.generate()so the test matches the API (fixes test bug only).Verification
pytest tests/test_formatters.py -k "CSS or empty"— all 7 passed (includingtest_generate_empty).GitHub issue
To be created and linked.