|
78 | 78 | } |
79 | 79 |
|
80 | 80 | $theme: digest-schema($tabs-schema); |
81 | | - $meta: map.get($theme, '_meta'); |
| 81 | + $variant: map.get($theme, '_meta', 'theme'); |
82 | 82 |
|
83 | | - @if not($item-text-color) and $item-background { |
84 | | - @if meta.type-of($item-background) == 'color' { |
85 | | - $item-text-color: rgba(text-contrast($item-background), .54); |
86 | | - } |
| 83 | + @if not($item-hover-background) and $item-background { |
| 84 | + $item-hover-background: hsl(from var(--item-background) h s calc(l * 0.9)); |
87 | 85 | } |
88 | 86 |
|
89 | | - @if not($item-hover-color) and $item-background { |
90 | | - $item-hover-color: text-contrast($item-background); |
| 87 | + @if not($item-active-background) and $item-background { |
| 88 | + $item-active-background: hsl(from var(--item-background) h s calc(l * 0.9)); |
91 | 89 | } |
92 | 90 |
|
93 | | - @if not($item-hover-color) and $item-hover-background { |
94 | | - $item-hover-color: text-contrast($item-hover-background); |
95 | | - } |
| 91 | + @if not($item-background) { |
| 92 | + @if not($item-text-color) and $item-icon-color { |
| 93 | + $item-text-color: var(--item-icon-color); |
| 94 | + } |
96 | 95 |
|
97 | | - @if not($item-active-icon-color) and $item-active-background { |
98 | | - $item-active-icon-color: text-contrast($item-active-background); |
99 | | - } |
| 96 | + @if not($item-icon-color) and $item-text-color { |
| 97 | + $item-icon-color: var(--item-text-color); |
| 98 | + } |
| 99 | + } @else { |
| 100 | + @if not($item-text-color) and $item-background { |
| 101 | + $item-text-color: hsla(from adaptive-contrast(var(--item-background)) h s l / 0.9); |
| 102 | + } |
100 | 103 |
|
101 | | - @if not($item-active-icon-color) and $item-background { |
102 | | - $item-active-icon-color: text-contrast($item-background); |
| 104 | + @if not($item-icon-color) and $item-background { |
| 105 | + $item-icon-color: hsla(from adaptive-contrast(var(--item-background) h s l / 0.9)); |
| 106 | + } |
103 | 107 | } |
104 | 108 |
|
105 | | - @if not($indicator-color) and $item-background { |
106 | | - $indicator-color: text-contrast($item-background); |
| 109 | + @if $variant == 'bootstrap' { |
| 110 | + @if not($item-hover-color) and $item-text-color { |
| 111 | + $item-hover-color: hsl(from var(--item-text-color) h s calc(l * 0.9)); |
| 112 | + } |
| 113 | + |
| 114 | + @if not($item-hover-icon-color) and $item-icon-color { |
| 115 | + $item-hover-icon-color: hsla(from var(--item-icon-color) h s calc(l * 0.9)); |
| 116 | + } |
| 117 | + |
| 118 | + @if not($border-color) and $item-background { |
| 119 | + $border-color: hsla(from adaptive-contrast(var(--item-background)) h s l / 0.5); |
| 120 | + } |
| 121 | + |
| 122 | + @if not($border-color--hover) and $border-color { |
| 123 | + $border-color--hover: var(--border-color); |
| 124 | + } |
| 125 | + } @else { |
| 126 | + @if not($item-hover-color) and $item-text-color { |
| 127 | + $item-hover-color: hsla(from var(--item-text-color) h s l / 1); |
| 128 | + } |
| 129 | + |
| 130 | + @if not($item-hover-icon-color) and $item-icon-color { |
| 131 | + $item-hover-icon-color: hsla(from var(--item-icon-color) h s l / 1); |
| 132 | + } |
| 133 | + |
| 134 | + @if not($item-background) { |
| 135 | + @if not($indicator-color) and $item-text-color { |
| 136 | + $indicator-color: var(--item-text-color); |
| 137 | + } |
| 138 | + |
| 139 | + @if not($indicator-color) and $item-icon-color { |
| 140 | + $indicator-color: var(--item-icon-color); |
| 141 | + } |
| 142 | + } @else { |
| 143 | + @if not($indicator-color) { |
| 144 | + $indicator-color: adaptive-contrast(var(--item-background)); |
| 145 | + } |
| 146 | + } |
107 | 147 | } |
108 | 148 |
|
109 | | - @if not($item-active-color) and $item-active-icon-color { |
110 | | - $item-active-color: $item-active-icon-color; |
| 149 | + @if not($item-active-background) { |
| 150 | + @if $variant != 'bootstrap' { |
| 151 | + @if not($item-active-icon-color) and $item-icon-color { |
| 152 | + $item-active-icon-color: var(--item-icon-color); |
| 153 | + } |
| 154 | + |
| 155 | + @if not($item-active-color) and $item-text-color { |
| 156 | + $item-active-color: var(--item-text-color); |
| 157 | + } |
| 158 | + } |
| 159 | + } @else { |
| 160 | + @if not($item-active-icon-color) and $item-active-background { |
| 161 | + $item-active-icon-color: adaptive-contrast(var(--item-active-background)); |
| 162 | + } |
| 163 | + |
| 164 | + @if not($item-active-color) and $item-active-background { |
| 165 | + $item-active-color: adaptive-contrast(var(--item-active-background)); |
| 166 | + } |
111 | 167 | } |
112 | 168 |
|
113 | 169 | // Button |
114 | | - @if not($button-color) and $item-background { |
115 | | - $button-color: text-contrast($item-background); |
116 | | - } |
| 170 | + @if $item-background { |
| 171 | + @if not($button-background) and $item-background { |
| 172 | + $button-background: var(--item-background); |
| 173 | + } |
117 | 174 |
|
118 | | - @if not($button-color) and $button-background { |
119 | | - $button-color: text-contrast($button-background); |
120 | | - } |
| 175 | + @if not($button-hover-background) and $item-background { |
| 176 | + $button-hover-background: hsl(from var(--item-background) h s calc(l * 0.9)); |
| 177 | + } |
| 178 | + } @else if not($button-background) { |
| 179 | + @if $variant != 'material' { |
| 180 | + @if not($button-color) and $item-text-color { |
| 181 | + $button-color: var(--item-text-color); |
| 182 | + } |
| 183 | + |
| 184 | + @if not($button-hover-color) and $button-color { |
| 185 | + $button-hover-color: hsl(from var(--button-color) h s calc(l * 0.9)); |
| 186 | + } |
121 | 187 |
|
122 | | - @if not($button-color) and $item-background { |
123 | | - $button-background: transparent; |
| 188 | + @if not($button-disabled-color) and $button-color { |
| 189 | + $button-disabled-color: hsla(from var(--button-color) h s l / 0.5); |
| 190 | + } |
| 191 | + } |
124 | 192 | } |
125 | 193 |
|
126 | | - @if not($button-hover-color) and $button-hover-background { |
127 | | - $button-hover-color: text-contrast($button-hover-background); |
| 194 | + @if $button-background { |
| 195 | + @if not($button-hover-background) and $button-background { |
| 196 | + $button-hover-background: hsl(from var(--button-background) h s calc(l * 0.9)); |
| 197 | + } |
128 | 198 | } |
129 | 199 |
|
130 | | - @if not($button-hover-background) and $item-background { |
131 | | - $button-hover-color: text-contrast($item-background); |
| 200 | + @if not($button-color) and $button-background { |
| 201 | + $button-color: adaptive-contrast(var(--button-background)); |
132 | 202 | } |
133 | 203 |
|
134 | | - @if not($button-background) and $item-background { |
135 | | - @if meta.type-of($item-background) == 'color' and lightness($item-background) > 50 { |
136 | | - $button-background: transparent; |
137 | | - } @else { |
138 | | - $button-background: rgba(255, 255, 255 , .1); |
139 | | - } |
| 204 | + @if not($button-hover-color) and $button-hover-background { |
| 205 | + $button-hover-color: adaptive-contrast(var(--button-hover-background)); |
140 | 206 | } |
141 | 207 |
|
142 | | - @if not($button-hover-background) and $item-background { |
143 | | - @if meta.type-of($item-background) == 'color' and lightness($item-background) > 50 { |
144 | | - $button-hover-background: rgba(0, 0, 0, .05); |
145 | | - } @else { |
146 | | - $button-hover-background: rgba(255, 255, 255 , .14); |
147 | | - } |
| 208 | + @if not($button-ripple-color) and $button-color { |
| 209 | + $button-ripple-color: var(--button-color); |
148 | 210 | } |
149 | 211 |
|
150 | | - @if not($button-ripple-color) and $button-background { |
151 | | - @if meta.type-of($item-background) == 'color' and lightness($item-background) > 50 { |
152 | | - $button-ripple-color: rgba(0, 0, 0, .4); |
153 | | - } @else { |
154 | | - $button-ripple-color: rgba(255, 255, 255, .4); |
155 | | - } |
| 212 | + @if not($button-disabled-color) and $button-color { |
| 213 | + $button-disabled-color: hsla(from var(--button-color) h s l / 0.4); |
156 | 214 | } |
| 215 | + |
157 | 216 | // Button end |
158 | 217 |
|
159 | 218 | @if not($tab-ripple-color) and $item-active-background { |
|
186 | 245 | tab-ripple-color: $tab-ripple-color, |
187 | 246 | button-ripple-color: $button-ripple-color, |
188 | 247 | border-color: $border-color, |
| 248 | + border-color--hover: $border-color--hover, |
189 | 249 | border-radius: $border-radius, |
190 | | - theme: map.get($schema, '_meta', 'theme'), |
191 | | - _meta: map.merge(if($meta, $meta, ()), ( |
192 | | - variant: map.get($schema, '_meta', 'theme'), |
193 | | - theme-variant: map.get($schema, '_meta', 'variant') |
194 | | - )), |
195 | 250 | )); |
196 | 251 | } |
197 | 252 |
|
|
203 | 258 | @mixin tabs($theme) { |
204 | 259 | @include css-vars($theme); |
205 | 260 |
|
206 | | - $variant: map.get($theme, '_meta', 'variant'); |
| 261 | + $variant: map.get($theme, '_meta', 'theme'); |
207 | 262 | $not-bootstrap-theme: $variant != 'bootstrap'; |
208 | 263 | $bootstrap-theme: $variant == 'bootstrap'; |
209 | 264 | $indigo-theme: $variant == 'indigo'; |
210 | | - $theme-variant: map.get($theme, '_meta', 'theme-variant'); |
| 265 | + $theme-variant: map.get($theme, '_meta', 'variant'); |
211 | 266 |
|
212 | 267 | $item-min-width: rem(90px); |
213 | 268 | $item-max-width: rem(360px); |
|
0 commit comments