基于vujs的vux的主题的配置

10 篇文章 0 订阅
5 篇文章 0 订阅

1.在项目的src目录下新建 src/styles/theme.less

2.在webpack.base.conf.js文件中的 plugins中加入如下代码:

{
  name: 'less-theme',
  path: 'src/styles/theme.less' // 相对项目根目录路径
}

如图:

3.将此代码复制到src/styles/theme.less中进行颜色的修该

4.修改源码中的颜色即可修改主题(如果不行 重启dev服务)

用以覆盖的less的源码:

源码地址:https://github.com/airyland/vux/blob/v2/src/styles/variable.less

@namespace: vux;

@theme-color: #04BE02;
@opacity-disabled: 0.5;

/**
* actionsheet
*/
/**
* en: primary type text color of menu item
* zh-CN: 菜单项primary类型的文本颜色
*/
@actionsheet-label-primary-color: #1AAD19;
/**
* en: warn type text color of menu item
* zh-CN: 菜单项warn类型的文本颜色
*/
@actionsheet-label-warn-color: #E64340;
/**
* en: default type text color of menu item
* zh-CN: 菜单项default类型的文本颜色
*/
@actionsheet-label-default-color: #000;
/**
* en: disabled type text color of menu item
* zh-CN: 菜单项disabled类型的文本颜色
*/
@actionsheet-label-disabled-color: #ccc;

/**
* datetime
*/
@datetime-header-item-font-color: @theme-color;
@datetime-header-item-cancel-font-color: #828282;
@datetime-header-item-confirm-font-color: @datetime-header-item-font-color;

/**
* tabbar
*/
@tabbar-text-active-color: #09BB07;

/**
* tab
*/
@tab-text-disabled-color: #ddd;
@tab-text-default-color: #666;
@tab-text-active-color: @theme-color;
@tab-bar-active-color: @theme-color;

/**
* dialog
*/
@dialog-button-text-primary-color: #0BB20C;
@dialog-button-text-default-color: #353535;
@dialog-button-text-warn-color: #E64340;
@dialog-width: 80%; // also affects alert confirm
@dialog-max-width: 300px; // also affects alert confirm
/**
* en: title and content's padding-left and padding-right
* zh-CN: 标题及内容区域的 padding-left 和 padding-right
*/
@dialog-gap-width: 1.6em; // alias @weuiDialogGapWidth

/**
* x-number
*/
@number-button-font-color: #3cc51f;
@number-input-font-color: #666;
@number-button-enabled-border-color: #ececec;
@number-square-button-enabled-border-color: @number-button-enabled-border-color;
@number-round-button-enabled-border-color: @number-button-font-color;
@number-button-disabled-border-color: @number-button-enabled-border-color;
@number-round-button-disabled-border-color: @number-button-enabled-border-color;

/**
* checkbox
*/
@checkbox-icon-color-checked: #09BB07;

/**
* check-icon
*/
@check-icon-color-checked: @checkbox-icon-color-checked;

/**
* Cell
*/
@cell-label-color: #000;
@cell-font-size: 17px;
@cell-tips-font-size: 14px;
@cell-default-arrow-color: #C8C8CD;
@cell-disabled-arrow-color: #e2e2e2;
@cell-default-arrow-border-width: 2px;
@cell-default-arrow-width: 6px;
@cell-value-color: #999;
@cell-placeholder-color: #999;

/**
* Mask
*/
@dialog-mask-background: rgba(0, 0, 0, .6);

/**
* Range
*/
@range-disabled-opacity: @opacity-disabled;
@range-bar-default-color: #a9acb1;
@range-bar-active-color: @theme-color;

/**
* Tabbar
*/
@tabbar-index: 100;

/**
* Header
*/
@header-background-color: #35495e;
@header-title-color: #fff;
@header-text-color: #ccc;
@header-arrow-color: #ccc;

/**
* Timeline
*/
@timeline-item-bg-color: @theme-color;

/**
* Switch
*/
@switch-checked-bg-color: @theme-color;
@switch-checked-border-color: @theme-color;
@switch-disabled-opacity: 0.6;
@switch-height: 32px;

/**
* Button
*/
/**
* en: border radius
* zh-CN: 圆角边框
*/
@button-global-border-radius: 5px;
/**
* en: font color
* zh-CN: 字体颜色
*/
@button-global-font-color: #FFFFFF;
/**
* en: margin-top value between previous button, not works when there is only one button
* zh-CN: 与相邻按钮的 margin-top 间隙,只有一个按钮时不生效
*/
@button-global-margin-top: 15px;
/**
* en: button height
* zh-CN: 按钮高度
*/
@button-global-height: 42px;
/**
* en: the font color in disabled
* zh-CN: disabled状态下的字体颜色
*/
@button-global-disabled-font-color: rgba(255,255,255,.6);
/**
* en: the font color in disabled
* zh-CN: disabled状态下的字体颜色
*/
@button-global-active-font-color: rgba(255,255,255,.6);
/**
* en: font size
* zh-CN: 字体大小
*/
@button-global-font-size: 18px;

/**
* en: the font size of the mini type
* zh-CN: mini类型的字体大小
*/
@button-mini-font-size: 13px;
/**
* en: the line height of the mini type
* zh-CN: mini类型的行高
*/
@button-mini-line-height: 2.3;

/**
* en: the background color of the warn type
* zh-CN: warn类型的背景颜色
*/
@button-warn-bg-color: #E64340;
/**
* en: the background color of the warn type in active
* zh-CN: active状态下,warn类型的背景颜色
*/
@button-warn-active-color: #CE3C39;
/**
* en: the background color of the warn type in disabled
* zh-CN: disabled状态下,warn类型的背景颜色
*/
@button-warn-disabled-bg-color: #EC8B89;

/**
* en: the background color of the default type
* zh-CN: default类型的背景颜色
*/
@button-default-bg-color: #F8F8F8;
/**
* en: the font color of the default type
* zh-CN: default类型的字体颜色
*/
@button-default-font-color: #000000;
/**
* en: the background color of the default type in active
* zh-CN: active状态下,default类型的背景颜色
*/
@button-default-active-bg-color: #DEDEDE;
/**
* en: the font color of the default type in disabled
* zh-CN: disabled状态下,default类型的字体颜色
*/
@button-default-disabled-font-color: rgba(0,0,0,.3);
/**
* en: the background color of the default type in disabled
* zh-CN: disabled状态下,default类型的背景颜色
*/
@button-default-disabled-bg-color: #F7F7F7;
/**
* en: the font color of the default type in active
* zh-CN: active状态下,default类型的字体颜色
*/
@button-default-active-font-color: rgba(0,0,0,.6);

/**
* en: the background color of the primary type
* zh-CN: primary类型的背景颜色
*/
@button-primary-bg-color: #1AAD19;
/**
* en: the background color of the primary type in active
* zh-CN: active状态下,primary类型的背景颜色
*/
@button-primary-active-bg-color: #179B16;
/**
* en: the background color of the primary type in disabled
* zh-CN: disabled状态下,primary类型的背景颜色
*/
@button-primary-disabled-bg-color: #9ED99D;

/**
* en: the font color of the plain primary type
* zh-CN: plain的primary类型的字体颜色
*/
@button-plain-primary-color: rgba(26,173,25,1);
/**
* en: the border color of the plain primary type
* zh-CN: plain的primary类型的边框颜色
*/
@button-plain-primary-border-color: rgba(26,173,25,1);
/**
* en: the font color of the plain primary type in active
* zh-CN: active状态下,plain的primary类型的字体颜色
*/
@button-plain-primary-active-color: rgba(26,173,25,.6);
/**
* en: the border color of the plain primary type in active
* zh-CN: active状态下,plain的primary类型的边框颜色
*/
@button-plain-primary-active-border-color: rgba(26,173,25,.6);

/**
* en: the font color of the plain default type
* zh-CN: plain的default类型的字体颜色
*/
@button-plain-default-color: rgba(53,53,53,1);
/**
* en: the border color of the plain default type
* zh-CN: plain的default类型的边框颜色
*/
@button-plain-default-border-color: rgba(53,53,53,1);
/**
* en: the font color of the plain default type in active
* zh-CN: active状态下,plain的default类型的字体颜色
*/
@button-plain-default-active-color: rgba(53,53,53,.6);
/**
* en: the border color of the plain default type in active
* zh-CN: active状态下,plain的default类型的边框颜色
*/
@button-plain-default-active-border-color: rgba(53,53,53,.6);

/**
* en: the font color of the plain warn type
* zh-CN: plain的warn类型的字体颜色
*/
@button-plain-warn-color: rgba(206,60,57,1);
/**
* en: the border color of the plain warn type
* zh-CN: plain的warn类型的边框颜色
*/
@button-plain-warn-border-color: rgba(206,60,57,1);
/**
* en: the font color of the plain warn type in active
* zh-CN: active状态下,plain的warn类型的字体颜色
*/
@button-plain-warn-active-color: rgba(206,60,57,.6);
/**
* en: the border color of the plain warn type in active
* zh-CN: active状态下,plain的warn类型的边框颜色
*/
@button-plain-warn-active-border-color: rgba(206,60,57,.6);

/**
* swipeout
*/
@swipeout-button-primary-bg-color: @button-primary-bg-color;
@swipeout-button-warn-bg-color: @button-warn-bg-color;
@swipeout-button-default-bg-color: #c8c7cd;

@swipeout-content-bg-color: #FFF;
@swipeout-button-font-color: #FFF;

/**
* Cell
*/
@cell-body-label-color: #000;

/**
* Badge
*/
/**
* en: badge background color
* zh-CN: badge的背景颜色
*/
@badge-bg-color: #f74c31;

/**
* Popover
*/
@popover-bg-color: #35495e;
@popover-font-color: #fff;
@popover-border-radius: 3px;
@popover-border-width: 5px;

/**
* Button tab
*/
/**
* en: not used
* zh-CN: 未被使用
*/
@button-tab-border-width: 1px;
/**
* en: border radius color
* zh-CN: 圆角边框的半径
*/
@button-tab-border-radius: 16px;
/**
* en: border color
* zh-CN: 边框的颜色
*/
@button-tab-border-color: @theme-color;
/**
* en: not used
* zh-CN: 默认状态下圆角边框的颜色
*/
@button-tab-default-border-color: @button-tab-border-color;
/**
* en: not used
* zh-CN: 未被使用
*/
@button-tab-active-border-color: @button-tab-border-color;
/**
* en: default background color
* zh-CN: 默认状态下的背景颜色
*/
@button-tab-default-background-color: #fdfdfd;
/**
* en: selected background color
* zh-CN: 选中状态下的背景颜色
*/
@button-tab-active-background-color: @theme-color;
/**
* en: not used
* zh-CN: 未被使用
*/
@button-tab-active-font-color: #FFF; /* alias */
/**
* en: not used
* zh-CN: 未被使用
*/
@button-tab-active-text-color: @button-tab-active-font-color;
/**
* en: default text color
* zh-CN: 默认状态下的文本颜色
*/
@button-tab-default-text-color: #999;
/**
* en: height
* zh-CN: 元素高度
*/
@button-tab-height: 30px;
/**
* en: line height
* zh-CN: 元素行高
*/
@button-tab-line-height: 31px;

/**
* Swiper
*/
@swiper-indicator-active-color: @theme-color;

/**
* checklist
*/
@checklist-icon-active-color: #09BB07;

/**
* popup-picker
*/
@popup-picker-header-text-color: @theme-color;
@popup-picker-header-bg-color: #fbf9fe;
@popup-picker-header-font-size: 16px;
@popup-picker-header-cancel-text-color: #828282;

/**
* popup
*/
@popup-background-color: #eee;

/**
* popup-header
*/
@popup-header-height: 44px;
@popup-header-bg-color: #fbf9fe;
@popup-header-font-size: 16px;
@popup-header-left-text-color: #828282;
@popup-header-right-text-color: @theme-color;
@popup-header-title-text-color: #222;
@popup-header-left-text-padding: 15px;
@popup-header-right-text-padding: 15px;

/**
* form-preview
*/
@form-preview-button-primary-color: #0BB20C;

/**
* sticky
*/
@sticky-zindex: 500;

/**
* group
*/
/**
* en: margin-top of title
* zh-CN: 标题的margin-top
*/
@group-title-margin-top: .77em;
/**
* en: margin-bottom of title
* zh-CN: 标题的margin-bottom
*/
@group-title-margin-bottom: .3em;
/**
* en: margin-top of footer title
* zh-CN: 底部标题的margin-top
*/
@group-footer-title-margin-top: .3em;
/**
* en: margin-bottom of footer title
* zh-CN: 底部标题的margin-bottom
*/
@group-footer-title-margin-bottom: .77em;

/**
* toast
*/
/**
* en: text color of content
* zh-CN: 内容文本颜色
*/
@toast-content-font-size: 16px;
/**
* en: default top
* zh-CN: 默认状态下距离顶部的高度
*/
@toast-top: 180px;
/**
* en: position top
* zh-CN: 顶部显示的高度
*/
@toast-position-top-offset: 10px;
/**
* en: position bottom
* zh-CN: 底部显示的高度
*/
@toast-position-bottom-offset: 10px;
/**
* en: z-index
* zh-CN: z-index
*/
@toast-z-index: 5001;

/**
* icon
*/
@icon-success-color: #09BB07;

/**
* calendar
*/
/**
* en: forward and backward arrows color
* zh-CN: 前进后退的箭头颜色
*/
@calendar-arrow-color: @theme-color;
/**
* en: text color of week highlight
* zh-CN: 周末高亮的文本颜色
*/
@calendar-highlight-color: #E59313;
/**
* en: background color when selected
* zh-CN: 选中时的背景颜色
*/
@calendar-selected-bg-color: @theme-color;
/**
* en: text color when disabled
* zh-CN: 禁用时的文本颜色
*/
@calendar-disabled-font-color: #c0c0c0;
/**
* en: text color of today
* zh-CN: 今天的文本颜色
*/
@calendar-today-font-color: @theme-color;
/**
* en: font size of cell
* zh-CN: 单元格的字号
*/
@calendar-date-item-font-size: 16px;
/**
* en: background color
* zh-CN: 背景颜色
*/
@calendar-bg-color: #fff;
/**
* en: size of date cell
* zh-CN: 日期单元格尺寸大小
*/
@calendar-each-date-item-size: 26px;
/**
* en: line height of date cell
* zh-CN: 日期单元格的行高
*/
@calendar-each-date-item-line-height: 25px;
/**
* en: text color of header
* zh-CN: 头部的文本颜色
*/
@calendar-header-day-item-color: #000;

/**
* week-calendar
*/
@week-calendar-bg: #fff;
@week-calendar-each-date-item-size: 26px;
@week-calendar-each-date-item-line-height: 25px;
@week-calendar-each-date-item-color: #444;
@week-calendar-selected-item-bg-color: @theme-color;
@week-calendar-selected-item-text-color: #fff;
@week-calendar-dot-color: #f74c31;
@week-calendar-header-day-item-color: #000;

/**
* search
*/
/**
* en: text color of cancel button
* zh-CN: 取消按钮文本颜色
*/
@search-cancel-font-color: #09BB07;
/**
* en: background color
* zh-CN: 背景颜色
*/
@search-bg-color: #EFEFF4;
/**
* en: text color of placeholder
* zh-CN: placeholder文本颜色
*/
@search-placeholder-font-color: #9B9B9B;

/**
* radio
*/
/**
* en: checked icon color
* zh-CN: 选中状态的图标颜色
*/
@radio-checked-icon-color: #09BB07;

/**
* loadmore
*/
/**
* en: not used
* zh-CN: 未被使用
*/
@load-more-line-color: #E5E5E5;

/**
* loading
*/
/**
* en: z-index
* zh-CN: z-index
*/
@loading-z-index: 5001;



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值