-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add Primitives v8 colors #529
Changes from 10 commits
af22fc4
180d645
d4d996c
fcc6841
405f202
f931a27
dad00b1
b58db20
3bb80ed
1f024b8
99be152
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/primitives": patch | ||
--- | ||
|
||
Add Primitives v8 colors (private dist for testing) | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,10 @@ const getCssSelectors = (outputFile: string): {selector: string; selectorLight: | |
const lastSlash = outputFile.lastIndexOf('/') | ||
const outputBasename = outputFile.substring(lastSlash + 1, outputFile.indexOf('.')) | ||
const themeName = outputBasename.replace(/-/g, '_') | ||
const mode = outputBasename.substring(0, 4) === 'dark' ? 'dark' : 'light' | ||
// const mode = outputBasename.substring(0, 4) === 'dark' ? 'dark' : 'light' | ||
|
||
return { | ||
selector: `[data-color-mode="${mode}"][data-${mode}-theme="${themeName}"]`, | ||
selector: `[data-color-mode="light"][data-light-theme="${themeName}"], [data-color-mode="dark"][data-dark-theme="${themeName}"]`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you changing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was working on updating the theme picker in Storybook last week with @colebemis and we found a bug with the selector stack. I think the theme picker was written in such a way that the theme would never fail to match the selector, and Cole suggested this change to make it match the logic in dotcom. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is really the case, I will do a PR just for this, so that it is not hidden in this giant one and can be more easily tracked. However I am not sure this is actually correct. Maybe @colebemis can add to this discussion. [data-color-mode="light"][data-light-theme="light_colorblind"],
[data-color-mode="auto"][data-light-theme="light_colorblind"] {
or
[data-color-mode="dark"][data-dark-theme="dark_high_contrast"],
[data-color-mode="auto"][data-light-theme="dark_high_contrast"] { With the proposed changes we get: [data-color-mode="light"][data-light-theme="light_colorblind"],
[data-color-mode="dark"][data-dark-theme="light_colorblind"],
[data-color-mode="auto"][data-light-theme="light_colorblind"] {
or
[data-color-mode="light"][data-light-theme="dark_high_contrast"],
[data-color-mode="dark"][data-dark-theme="dark_high_contrast"],
[data-color-mode="auto"][data-light-theme="dark_high_contrast"] { What is added is a line I think will never execute. As far as I see you can't get a combination of Am I missing something? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah that's correct, in dotcom ui, when selecting single mode, you'll only get the corresponding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this change for now, and we can bring it back later if we find it necessary in dotcom! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, you're right. I got confused because that combination is technically possible in code. I didn't realize dotcom prevents that from happening |
||
selectorLight: `[data-color-mode="auto"][data-light-theme="${themeName}"]`, | ||
selectorDark: `[data-color-mode="auto"][data-dark-theme="${themeName}"]`, | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
base: { | ||
color: { | ||
black: { | ||
$value: '#1b1f24', | ||
$value: '#1f2328', | ||
$type: 'color', | ||
}, | ||
transparent: { | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,242 @@ | ||
{ | ||
topicTag: { | ||
borderColor: { | ||
$value: '{base.color.transparent}', | ||
$type: 'color', | ||
}, | ||
}, | ||
highlight: { | ||
neutral: { | ||
bgColor: { | ||
$value: '{base.color.yellow.3}', | ||
$type: 'color', | ||
alpha: 0.4, | ||
}, | ||
}, | ||
}, | ||
page: { | ||
header: { | ||
bgColor: { | ||
$value: '{bgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
diffBlob: { | ||
addition: { | ||
fgColor: { | ||
text: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
num: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
bgColor: { | ||
num: { | ||
$value: '{base.color.green.3}', | ||
$type: 'color', | ||
alpha: 0.3, | ||
}, | ||
line: { | ||
$value: '{base.color.green.4}', | ||
$type: 'color', | ||
alpha: 0.15, | ||
mix: null, | ||
}, | ||
word: { | ||
$value: '{base.color.green.4}', | ||
$type: 'color', | ||
alpha: 0.4, | ||
}, | ||
}, | ||
}, | ||
deletion: { | ||
fgColor: { | ||
text: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
num: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
bgColor: { | ||
num: { | ||
$value: '{base.color.red.4}', | ||
$type: 'color', | ||
alpha: 0.3, | ||
}, | ||
line: { | ||
$value: '{base.color.red.4}', | ||
$type: 'color', | ||
alpha: 0.15, | ||
mix: null, | ||
}, | ||
word: { | ||
$value: '{base.color.red.4}', | ||
$type: 'color', | ||
alpha: 0.4, | ||
}, | ||
}, | ||
}, | ||
hunk: { | ||
bgColor: { | ||
num: { | ||
$value: '{borderColor.accent.muted}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
expander: { | ||
iconColor: { | ||
$value: '{fgColor.muted}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
diffStat: { | ||
addition: { | ||
bgColor: { | ||
$value: '{bgColor.success.emphasis}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
codeMirror: { | ||
fgColor: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
bgColor: { | ||
$value: '{bgColor.default}', | ||
$type: 'color', | ||
}, | ||
gutters: { | ||
bgColor: { | ||
$value: '{bgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
gutterMarker: { | ||
fgColor: { | ||
default: { | ||
$value: '{bgColor.default}', | ||
$type: 'color', | ||
}, | ||
muted: { | ||
$value: '{fgColor.muted}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
lineNumber: { | ||
fgColor: { | ||
$value: '{fgColor.muted}', | ||
$type: 'color', | ||
}, | ||
}, | ||
cursor: { | ||
fgColor: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
selection: { | ||
bgColor: { | ||
$value: '{borderColor.accent.muted}', | ||
$type: 'color', | ||
}, | ||
}, | ||
activeline: { | ||
bgColor: { | ||
$value: '{bgColor.neutral.muted}', | ||
$type: 'color', | ||
}, | ||
}, | ||
matchingBracket: { | ||
fgColor: { | ||
$value: '{fgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
lines: { | ||
bgColor: { | ||
$value: '{bgColor.default}', | ||
$type: 'color', | ||
}, | ||
}, | ||
syntax: { | ||
fgColor: { | ||
comment: { | ||
$value: '{base.color.gray.3}', | ||
$type: 'color', | ||
}, | ||
constant: { | ||
$value: '{base.color.blue.2}', | ||
$type: 'color', | ||
}, | ||
entity: { | ||
$value: '{base.color.purple.2}', | ||
$type: 'color', | ||
}, | ||
keyword: { | ||
$value: '{base.color.red.3}', | ||
$type: 'color', | ||
}, | ||
storage: { | ||
$value: '{base.color.red.3}', | ||
$type: 'color', | ||
}, | ||
string: { | ||
$value: '{base.color.blue.1}', | ||
$type: 'color', | ||
}, | ||
support: { | ||
$value: '{base.color.blue.2}', | ||
$type: 'color', | ||
}, | ||
variable: { | ||
$value: '{base.color.orange.2}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
}, | ||
header: { | ||
fgColor: { | ||
default: { | ||
$value: '{fgColor.onEmphasis}', | ||
$type: 'color', | ||
alpha: 0.7, | ||
}, | ||
logo: { | ||
$value: '{fgColor.onEmphasis}', | ||
$type: 'color', | ||
}, | ||
}, | ||
bgColor: { | ||
$value: '{base.color.gray.9}', | ||
$type: 'color', | ||
}, | ||
borderColor: { | ||
divider: { | ||
$value: '{base.color.gray.3}', | ||
$type: 'color', | ||
}, | ||
}, | ||
}, | ||
headerSearch: { | ||
bgColor: { | ||
$value: '{base.color.gray.9}', | ||
$type: 'color', | ||
}, | ||
borderColor: { | ||
$value: '{base.color.gray.6}', | ||
$type: 'color', | ||
}, | ||
}, | ||
} |
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.
Do we have another name for this effort? It would be v3 of renaming efforts, although it doesn't match Primitives's current semver version. π€
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'm trying to refer to this as the next major (v8) release of Primitives vs. v3, which I think sounds a little nicer and more accurate! In v8 we will also ship all the sizing tokens without fallbacks, so it truly feels like a big major release.