Repository navigation
Conversation
#fff parsed as 0x000fff, so luminance() returned ~0.14 and a white background was treated as dark. Expand shorthand before parsing and treat anything that is not a full hex colour as the light default.
Contributor
Author
|
Closing this in favour of #73, which was opened while I was running the tests — same fix, no need to review two PRs for one issue. |
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.
What does this change?
Reads three-digit hex colours in the draft engine.
luminance()assumed a six-digit#rrggbbvalue, so#fffparsed as0x000fffand gave a luminance of about 0.14 — a white background was treated as dark and the beat rendered white-on-black. Anything that is not a full hex colour now reads as white, which is the light defaultcolors()already uses for a missingbg.Fixes #72
How did you test it?
npm testpasses (30 tests; 28 pass, 2 pre-existing skips)npm run checkpasses#fffnow selects the same light palette as#ffffff, no layout changeAdded
test/drafts-hex.test.js:#fffequals#ffffff,#08fequals#0088ff,#fff/#eeeare light and#000is dark, andwhite,#ff,#ggg,''andundefinedall fall back to light. Against the oldluminance()the file fails.Checklist
showcase/or Gitdocs/drafts.mdalready calls the value "a hex colour"