-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: corrected midtone color outputs #46
Merged
Merged
Conversation
This file contains 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
NateBaldwinDesign
added a commit
that referenced
this pull request
Feb 18, 2020
* added function for creating base scale * updated demo contrast enhancement * initial separation for base-scale package * more refactoring with separate package * Revert "updated demo contrast enhancement" This reverts commit 2c932b2. Modularization of base-scale to unique package moved to separate branch. * Fixed revert errors. Updated demo for proper contrast multiplier mapping. Added test to generateBaseScale. * created function with tests * added initial generateAdaptiveTheme function with tests * feat: generateAdaptiveTheme outputs function allowing user to define theme as a function itself * trivial: removed array brackets from test arguments for colorspace * added error throw for missing name in color object * feat: destructured arguments for generateAdaptiveTheme. Added condition to return values or return function depending on presence of brightness value * updated Demo to use function * moved color config vars outside of createColors function for simplicity * updated param names, demo, and tests. Added docs to README.md * added output docs to readme * update readme to show theme example at top of doc * added site analytics to index and demo (#38) * removed content that bled over from other branch (#39) * updated issue templates * Color converter (#40) * feat: adding in color converter page * updated citation on converter * made logo into link back to index.html * feat: output proper colors, converter include input formats for cross-conversion * @trivial * corrected order of colorspaces in converter for consistency * feat: added hex to output conversion types (#41) * fix: changed form to div in converter to prevent refresh on submit (#43) * fix: corrected midtone color outputs (#46) * fix: corrected midtone color outputs * @trivial: removed temporary window export * chore(release): release - @adobe/[email protected] - @adobe/[email protected] * added function for creating base scale * updated demo contrast enhancement * initial separation for base-scale package * more refactoring with separate package * Revert "updated demo contrast enhancement" This reverts commit 2c932b2. Modularization of base-scale to unique package moved to separate branch. * Fixed revert errors. Updated demo for proper contrast multiplier mapping. Added test to generateBaseScale. * created function with tests * added initial generateAdaptiveTheme function with tests * feat: generateAdaptiveTheme outputs function allowing user to define theme as a function itself * trivial: removed array brackets from test arguments for colorspace * added error throw for missing name in color object * feat: destructured arguments for generateAdaptiveTheme. Added condition to return values or return function depending on presence of brightness value * updated Demo to use function * moved color config vars outside of createColors function for simplicity * updated param names, demo, and tests. Added docs to README.md * added output docs to readme * update readme to show theme example at top of doc * updated generateAdaptiveTheme with currying * updated theme output into structured json object * updates to readme * reformatting API reference in readme * @trivial readme formatting * updated docs, minPositive test, and formatting issues * updated baseScale argument to be string enum of user input colorScale arguments * added test to ensure base throws error if not valid option
Merged
thierryc
pushed a commit
to thierryc/leonardo
that referenced
this pull request
Mar 29, 2024
* fix: corrected midtone color outputs * @trivial: removed temporary window export
thierryc
pushed a commit
to thierryc/leonardo
that referenced
this pull request
Mar 29, 2024
* added function for creating base scale * updated demo contrast enhancement * initial separation for base-scale package * more refactoring with separate package * Revert "updated demo contrast enhancement" This reverts commit 2c932b2. Modularization of base-scale to unique package moved to separate branch. * Fixed revert errors. Updated demo for proper contrast multiplier mapping. Added test to generateBaseScale. * created function with tests * added initial generateAdaptiveTheme function with tests * feat: generateAdaptiveTheme outputs function allowing user to define theme as a function itself * trivial: removed array brackets from test arguments for colorspace * added error throw for missing name in color object * feat: destructured arguments for generateAdaptiveTheme. Added condition to return values or return function depending on presence of brightness value * updated Demo to use function * moved color config vars outside of createColors function for simplicity * updated param names, demo, and tests. Added docs to README.md * added output docs to readme * update readme to show theme example at top of doc * added site analytics to index and demo (adobe#38) * removed content that bled over from other branch (adobe#39) * updated issue templates * Color converter (adobe#40) * feat: adding in color converter page * updated citation on converter * made logo into link back to index.html * feat: output proper colors, converter include input formats for cross-conversion * @trivial * corrected order of colorspaces in converter for consistency * feat: added hex to output conversion types (adobe#41) * fix: changed form to div in converter to prevent refresh on submit (adobe#43) * fix: corrected midtone color outputs (adobe#46) * fix: corrected midtone color outputs * @trivial: removed temporary window export * chore(release): release - @adobe/[email protected] - @adobe/[email protected] * added function for creating base scale * updated demo contrast enhancement * initial separation for base-scale package * more refactoring with separate package * Revert "updated demo contrast enhancement" This reverts commit 2c932b2. Modularization of base-scale to unique package moved to separate branch. * Fixed revert errors. Updated demo for proper contrast multiplier mapping. Added test to generateBaseScale. * created function with tests * added initial generateAdaptiveTheme function with tests * feat: generateAdaptiveTheme outputs function allowing user to define theme as a function itself * trivial: removed array brackets from test arguments for colorspace * added error throw for missing name in color object * feat: destructured arguments for generateAdaptiveTheme. Added condition to return values or return function depending on presence of brightness value * updated Demo to use function * moved color config vars outside of createColors function for simplicity * updated param names, demo, and tests. Added docs to README.md * added output docs to readme * update readme to show theme example at top of doc * updated generateAdaptiveTheme with currying * updated theme output into structured json object * updates to readme * reformatting API reference in readme * @trivial readme formatting * updated docs, minPositive test, and formatting issues * updated baseScale argument to be string enum of user input colorScale arguments * added test to ensure base throws error if not valid option
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.
Description
Lighter midtone base colors were outputting pure white for the generated colors when they should be outputting color.
Switched from using relative luminance as the measure of base color's brightness to a more perceptually uniform lightness value in HSLuv. Both are measured as 0-1 or 0-100 (such as percent), however the mid-value of each is very different. Perceptually, 50% should be the mid-mark, however this is not the case for relative luminance. Chart shows HSLuv value for a set of random colors (blue) vs the relative luminance of those same colors (orange) with a mid-tone mark at 50%
![image](https://user-images.githubusercontent.com/13972198/72824320-4dd41f00-3c32-11ea-97d3-42fb0d83aa53.png)
The 50% mark is not the sole motivation for switching to HSLuv lightness for calculating when to switch directionality of ratios, but also due to the inaccuracy of the relative luminance formula and the confidence level that is present with the perceptive luminance of colors in HSLuv space.
Specific changes:
contrast()
function,baseV
argument can be passed. BaseV is used rather than originally calculating the luminance of the base color as the condition.generateContrastColors()
function,baseV
is defined as the base color's HSLuv lightness value and passed to the contrasts mapping function.generateContrastColors()
function,baseV
is passed through the binary search function rather than the luminance of the base color.Fixes #31
Motivation
Fix bugs
Screenshots
To-do list