123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- @import '@/uni.scss';
- $theme-map: ();
- $primary-key: 'primary';
- $success-key: 'success';
- $warn-key: 'warn';
- $warning-key: 'warning';
- $error-key: 'error';
- @mixin themeify {
- @each $theme-name, $theme-map in $themes {
- $theme-map: $theme-map !global;
- [data-theme='#{inspect($theme-name)}'] {
- @content;
- }
- }
- }
- @function getTheme($key) {
- @return map-get($theme-map, $key);
- }
- @mixin uni-button($button-type) {
- $button-type-color: getTheme(#{$button-type + '-color'});
- uni-button,
- button {
- &[type='#{$button-type}'] {
- background-color: $button-type-color;
- &[disabled] {
- background-color: opacify($button-type-color, 0.6);
- }
- &[plain] {
- color: $button-type-color;
- border-color: $button-type-color;
- background-color: transparent;
- }
- &[loading] {
- background-color: $button-type-color;
- &[plain] {
- color: $button-type-color;
- }
- }
- &.button-hover {
- $hover-color: darken(
- $color: $button-type-color,
- $amount: 10%
- );
- background-color: $hover-color;
- &[plain] {
- color: $hover-color;
- border-color: $hover-color;
- background-color: transparent;
- }
- }
- }
- }
- }
- @mixin uni-switch {
- $primary-color: getTheme(#{$primary-key + '-color'});
- .uni-switch-input.uni-switch-input-checked {
- background-color: $primary-color !important;
- border-color: $primary-color !important;
- }
- }
- @mixin uni-ui-checkbox {
- $primary-color: getTheme(#{$primary-key + '-color'});
- .checklist-box {
- &.is-checked {
- .checkbox__inner {
- border-color: $primary-color !important;
- background-color: $primary-color !important;
- }
- .radio__inner {
- border-color: $primary-color !important;
- .radio__inner-icon {
- background-color: $primary-color !important;
- }
- }
- .checklist-text {
- color: $primary-color !important;
- }
- }
- .checkbox__inner:hover {
- border-color: $primary-color !important;
- }
- }
- }
- @mixin uni-ui-easyinput {
- $primary-color: getTheme(#{$primary-key + '-color'});
- $error-color: getTheme(#{$error-key + '-color'});
- .uni-easyinput {
- &.uni-easyinput-error {
- color: $error-color !important;
- }
- .uni-easyinput__content {
- &.is-focused {
- &.is-input-border {
- border-color: $primary-color !important;
- }
- .uni-icons {
- color: $primary-color !important;
- }
- }
- }
- }
- }
- @mixin uni-menu {
- $primary-color: getTheme(#{$primary-key + '-color'});
- // 左侧菜单
- .uni-nav-menu {
- .uni-menu-item.is-active {
- color: $primary-color;
- }
- }
- // 修改密码
- .navbar-menu {
- .menu-item.hover-highlight:hover {
- color: $primary-color;
- }
- }
- }
- @mixin uni-table {
- $primary-color: getTheme(#{$primary-key + '-color'});
- .uni-table {
- .link-btn-color {
- color: $primary-color;
- }
- .uni-table-checkbox {
- .checkbox__inner {
- &.checkbox--indeterminate,
- &.is-checked {
- border-color: $primary-color;
- background-color: $primary-color;
- }
- }
- .checkbox__inner:hover {
- border-color: $primary-color;
- }
- }
- .uni-table-th-content {
- .arrow-box {
- .arrow.active ::after {
- background-color: $primary-color;
- }
- }
- }
- // 表格头部搜索按钮
- .opera-area {
- .btn.btn-submit {
- background-color: $primary-color;
- }
- }
- .dropdown-btn {
- .icon-search.active {
- .icon-search-0 {
- border-color: $primary-color;
- }
- .icon-search-1 {
- background-color: $primary-color;
- }
- }
- .icon-calendar.active {
- .icon-calendar-0 {
- border-color: $primary-color;
- }
- .icon-calendar-1 {
- background-color: $primary-color;
- }
- }
- }
- .uni-icons.uni-stat-edit--btn {
- color: $primary-color !important;
- }
- }
- .uni-pagination {
- .uni-pagination__num-current .page--active {
- background-color: $primary-color !important;
- }
- }
- }
- @mixin uni-picker {
- $primary-color: getTheme(#{$primary-key + '-color'});
- .uni-picker-select {
- .uni-picker-item.selected {
- color: $primary-color;
- }
- }
- }
- @mixin uni-calendar {
- $primary-color: getTheme(#{$primary-key + '-color'});
- .uni-calendar__button-text {
- color: $primary-color;
- }
- .uni-datetime-picker--btn {
- background-color: $primary-color;
- }
- .uni-calendar-item--multiple {
- .uni-calendar-item--before-checked,
- .uni-calendar-item--after-checked {
- background-color: $primary-color;
- }
- }
- .uni-calendar-item__weeks-box {
- .uni-calendar-item--checked {
- background-color: $primary-color;
- }
- &-text {
- color: darken($color: $primary-color, $amount: 40%);
- }
- }
- }
- @mixin uni-popup {
- $primary-color: getTheme(#{$primary-key + '-color'});
- .uni-popup-dialog {
- .uni-button-color {
- color: $primary-color;
- }
- }
- }
- @mixin uni-tag($tag-type) {
- $tag-type-color: getTheme(#{$tag-type + '-color'});
- .uni-tag {
- &--#{$tag-type} {
- &--inverted {
- background-color: #fff !important;
- color: $tag-type-color !important;
- }
- background-color: $tag-type-color !important;
- border-color: $tag-type-color !important;
- }
- }
- }
- body {
- @at-root {
- @include themeify {
- $primary-color: getTheme(#{$primary-key + '-color'});
- // 组件
- @include uni-button($primary-key);
- @include uni-button($warn-key);
- @include uni-tag($primary-key);
- @include uni-tag($success-key);
- @include uni-tag($warning-key);
- @include uni-tag($error-key);
- @include uni-ui-checkbox;
- @include uni-switch;
- @include uni-ui-easyinput;
- @include uni-menu;
- @include uni-table;
- @include uni-picker;
- @include uni-calendar;
- @include uni-popup;
- // 页面
- .link-btn {
- color: $primary-color !important;
- }
- .uni-stat--tab-item {
- &.uni-stat--tab-item-line-active,
- &.uni-stat--tab-item-boldLine-active {
- color: $primary-color;
- border-color: $primary-color;
- }
- &.uni-stat--tab-item-box-active {
- border-color: $primary-color;
- }
- }
- .uni-title.app-list {
- color: $primary-color;
- border-color: $primary-color;
- }
- .uni-link {
- color: $primary-color;
- }
- .uni-selector-select .uni-picker-item.selected {
- color: $primary-color;
- }
- .uni-tabs__item.is-active {
- color: $primary-color;
- }
- .uni-modal__btn_primary {
- color: $primary-color !important;
- }
- .uni-radio-input-checked {
- background-color: $primary-color !important;
- border-color: $primary-color !important;
- }
- .uni-container {
- .icon-item:hover,
- .icon-item:hover .icon-text {
- color: $primary-color;
- }
- }
- }
- }
- }
|