-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
UI lib - new theme colors #7375
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
76f7429
add initial design system palette
pettinarip b3e8fcb
define colors from old theme into new theme to make the transition
pettinarip cd08d7f
do not define nested colors as semantic tokens
pettinarip 8045947
sync colors with design system
pettinarip 45da1f7
simplify semantic tokens definition
pettinarip 2b3115d
Apply suggestions from code review
pettinarip File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
export type Colors = typeof colors | ||
|
||
const colors = {} | ||
const colors = { | ||
grey: { | ||
100: "#f7f7f7", | ||
300: "#d4d4d4", | ||
500: "#646464", | ||
700: "#222222", | ||
900: "#141414", | ||
}, | ||
blue: { | ||
100: "#e8e8ff", | ||
300: "#8d8dff", | ||
500: "#1c1cff", | ||
700: "#0b0b66", | ||
}, | ||
orange: { | ||
100: "#ffe3d3", | ||
300: "#ffb991", | ||
500: "#ff7324", | ||
800: "#451900", | ||
}, | ||
red: { | ||
600: "#b80000", | ||
}, | ||
green: { | ||
500: "#109e62", | ||
}, | ||
yellow: { | ||
200: "#fff8df", | ||
}, | ||
} | ||
|
||
export default colors |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
lightTheme as oldLightTheme, | ||
darkTheme as oldDarkTheme, | ||
} from "../../theme" | ||
|
||
const oldLightThemeColors = oldLightTheme.colors | ||
const oldDarkThemeColors = oldDarkTheme.colors | ||
|
||
// define each of the old colors as a `semanticToken`: | ||
// `name: { _light: lightColor, _dark: darkColor }` | ||
const oldColors = Object.keys(oldLightThemeColors).reduce((colors, color) => { | ||
const lightColor = oldLightThemeColors[color] | ||
const darkColor = oldDarkThemeColors[color] | ||
|
||
if (typeof lightColor !== "string" || typeof darkColor !== "string") { | ||
return colors | ||
} | ||
|
||
return { | ||
...colors, | ||
[color]: { _light: lightColor, _dark: darkColor }, | ||
} | ||
}, {}) | ||
|
||
const semanticTokens = { | ||
colors: { | ||
// define old colors from the old theme as semanticTokens to transition | ||
// from emotion components to chakra | ||
// TODO: remove these colors as we migrate away from them | ||
...oldColors, | ||
|
||
// Design System colors | ||
primary: { _light: "blue.500", _dark: "orange.500" }, | ||
primaryDark: { _light: "blue.700", _dark: "orange.800" }, | ||
primaryHover: { _light: "blue.300", _dark: "orange.300" }, | ||
pettinarip marked this conversation as resolved.
Show resolved
Hide resolved
|
||
primaryLight: { _light: "blue.100", _dark: "orange.100"}, | ||
body: { _light: "grey.700", _dark: "grey.100" }, | ||
bodyLight: { _light: "grey.500", _dark: "grey.100" }, | ||
disabled: { _light: "grey.300", _dark: "grey.500" }, | ||
background: { _light: "white", _dark: "grey.700" }, | ||
success: "green.500", | ||
error: "red.600", | ||
attention: "yellow.200", | ||
}, | ||
} | ||
|
||
export default semanticTokens |
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
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.
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.
This is to do the migration as seamless as possible. Detailed in the migration guide under the
## Theme colors
header. #7368The idea is that we keep using the same color variable names.