-
Notifications
You must be signed in to change notification settings - Fork 57
UI Customizations
Alexander Popadyuk edited this page Nov 19, 2020
·
3 revisions
- Go to
/packages/origin-ui/src/styles/variables.scss
- Here you can change:
- $primaryColor - main theme color, should be bright one.
- $textColorDefault - the main text color for whole application.
- $simpleTextColor - secondary text color, should be either
#000000
or#ffffff
. - $bodyBackgroundColor - background color used only for
<body>
tag. - $mainBackgroundColor - background color used for all components in the application. It is not recommended to use black or white color for this variable, because all other colors in the application are lighten or darken from the main color and this may affect the general styling.
- In component get configuration using hook
useOriginConfiguration()
. - Get the color you want to adjust, example:
const originBgColor = configuration?.styleConfig?.MAIN_BACKGROUND_COLOR`
- Lighten or darken the original color using
LightenColor(color, percent)
fromorigin-ui-core
package.
For lighten use positive percentage, for darken use negative percentage. - Apply new color to your component.
- Go to
/packages/origin-ui/src/components/OriginConfigurationContext.tsx
. - Find 'createMaterialThemeForOrigin' function.
- In return statement you can adjust the colors applied to the Material-UI components throughout application.
Notes:
It is recommended to avoid using hard-coded colors, example: backgroundColor: #363636
. Always try to lighten or darken one of already existing colors.
If it is impossible to achieve the needed color with lighten tool:
- Add new variable to scss file.
- Add it to the
OriginConfigurationContext
inorigin-ui
. - Retrieve it from the configuration context.