-
Notifications
You must be signed in to change notification settings - Fork 109
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
Custom output color names option #81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could definitely see a case where someone would want to add exact names for each color, however, I would personally prefer a function call where I can return whatever name I want, OR a string that would have substitutions in it, i.e. $color-$value
would give me gray-100
. However, that's a separate PR and issue.
Code looks fine and the API makes sense, however, it may be that ratios
and swatchNames
could be combined into an object:
{
name: "gray",
colorKeys: ['#cacaca'],
colorspace: 'HSL',
ratios: {
GRAY_1: -1.8,
GRAY_2: -1.2,
GRAY_3: 1,
GRAY_4: 1.2,
GRAY_5: 1.4,
GRAY_6: 2,
GRAY_7: 3,
GRAY_8: 4.5,
GRAY_9: 6,
GRAY_10: 8,
GRAY_11: 12,
GRAY_12: 21
}
}
That's a good point. The object would definitely help reinforce the relationship, rather than simply indexing each array. |
@NateBaldwinDesign at that point, however, the name |
Yeah that opens up a lot of ambiguity in names and what is being captured by this parameter.
Combining them sounds appropriate, however the naming is less clear. I have reservations myself about the term Perhaps I would still want to make sure this supports both an object or an array. The name For example, if named: {
name: "gray",
colorKeys: ['#cacaca'],
contrastSwatches: {
GRAY_1: -1.8,
GRAY_2: -1.2,
GRAY_3: 1,
GRAY_4: 1.2,
GRAY_5: 1.4,
GRAY_6: 2,
GRAY_7: 3,
GRAY_8: 4.5
}
} And if unnamed: {
name: "gray",
colorKeys: ['#cacaca'],
contrastSwatches: [
-1.8,
-1.2,
1,
1.2,
1.4,
2,
3,
4.5
]
} |
* added option for color scales in * updated test for error * updated to allow ratios input as an object
Description
Added option to
generateAdaptiveTheme
function within eachcolorScale
object for definingratios
as either an array or an objectThis closes #80
User can pass custom swatch names to have used in the generated color output. If an array of numbers is passed, the default (current) naming convention is used in the output.
Option has been documented in the README.
Tests are included to validate proper output whether array or object is passed.
Motivation
This will make implementation easier within a design system where the user has specifically named color system. This helps to solve the use case where Leonardo may be used to override existing named tokens.
Screenshots
To-do list