order | title |
---|---|
5 |
Customize Theme |
Ant Design allows you to customize some basic design aspects in order to meet the needs of UI diversity from business and brand, including primary color, border radius, border color, etc.
We are using Less as the development language for styling. A set of less variables are defined for each design aspect that can be customized to your needs.
Please report an issue if the existing list of variables is not enough for you.
We recommend modifyVars to override the default values of the variables. There are two ways to achieve it in practice.
theme
property (recommended way)Specify the theme
property in the package.json
or .webpackrc
file, whose value can be either an object or the path to a JS file that contains the custom values of specific variables:
"theme": {
"primary-color": "#1DA57A",
},
Note:
style
option of babel-plugin-import, change it from 'css'
to true
, which will import the less
version of choerodon-ui.'choerodon-ui/dist/choerodon-ui.css'
, change it to choerodon-ui/dist/choerodon-ui.less
.dva-cli@0.7.0+
, you should add the theme
block to .roadhogrc instead of package.json
.@icon-url
, the value must be contained in quotes like "@icon-url": "'your-icon-font-path'"
(A fix sample).Override variables via less definition files.
Create a standalone less file like the one below, and import it in your project.
@import "~choerodon-ui/dist/choerodon-ui.less"; // import official less entry file
@import "your-theme-file.less"; // override variables here
Note: This way will load the styles of all components, regardless of your demand, which cause style
option of babel-plugin-import
not working.
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )