|
120 | 120 | }
|
121 | 121 |
|
122 | 122 | $theme: digest-schema($button-group-schema);
|
123 |
| - $meta: map.get($theme, '_meta'); |
124 | 123 |
|
125 | 124 | $border: rem(1px) solid map.get($theme, 'item-selected-border-color');
|
126 | 125 |
|
| 126 | + //background colors |
| 127 | + @if not($item-hover-background) and $item-background { |
| 128 | + $item-hover-background: hsl(from var(--item-background) h s calc(l * 0.9)); |
| 129 | + } |
| 130 | + |
| 131 | + @if not($item-selected-background) and $item-background { |
| 132 | + $item-selected-background: hsl(from var(--item-background) h s calc(l * 0.7)); |
| 133 | + } |
| 134 | + |
| 135 | + @if not($item-selected-hover-background) and $item-selected-background { |
| 136 | + $item-selected-hover-background: hsl(from var(--item-selected-background) h s calc(l * 1.1)); |
| 137 | + } |
| 138 | + |
| 139 | + @if not($item-selected-focus-background) and $item-selected-background { |
| 140 | + $item-selected-focus-background: var(--item-selected-background); |
| 141 | + } |
| 142 | + |
| 143 | + @if not($item-selected-focus-hover-background) and $item-selected-hover-background { |
| 144 | + $item-selected-focus-hover-background: var(--item-selected-hover-background); |
| 145 | + } |
| 146 | + |
| 147 | + @if not($item-focused-background) and $item-background { |
| 148 | + $item-focused-background: var(--item-hover-background); |
| 149 | + } |
| 150 | + |
| 151 | + @if not($item-focused-hover-background) and $item-hover-background { |
| 152 | + $item-focused-hover-background: hsl(from var(--item-focused-background) h s calc(l * 0.9)); |
| 153 | + } |
| 154 | + |
| 155 | + @if not($disabled-background-color) and $item-background { |
| 156 | + $disabled-background-color: var(--item-background); |
| 157 | + } |
| 158 | + |
| 159 | + @if not($disabled-selected-background) and $item-selected-background { |
| 160 | + $disabled-selected-background: rgba(gray, 0.3); |
| 161 | + } |
| 162 | + |
| 163 | + //border colors |
| 164 | + @if not($item-border-color) and $item-background { |
| 165 | + $item-border-color: hsl(from var(--item-background) h s calc(l * 0.8)); |
| 166 | + } |
| 167 | + |
| 168 | + @if not($item-hover-border-color) and $item-border-color { |
| 169 | + $item-hover-border-color: var(--item-border-color); |
| 170 | + } |
| 171 | + |
| 172 | + @if not($item-focused-border-color) and $item-border-color { |
| 173 | + $item-focused-border-color: var(--item-border-color); |
| 174 | + } |
| 175 | + |
| 176 | + @if not($item-selected-border-color) and $item-border-color { |
| 177 | + $item-selected-border-color: var(--item-border-color); |
| 178 | + } |
| 179 | + |
| 180 | + @if not($item-selected-hover-border-color) and $item-border-color { |
| 181 | + $item-selected-hover-border-color: var(--item-border-color); |
| 182 | + } |
| 183 | + |
| 184 | + @if not($item-disabled-border) and $item-border-color { |
| 185 | + $item-disabled-border: var(--item-border-color); |
| 186 | + } |
| 187 | + |
| 188 | + @if not($disabled-selected-border-color) and $item-border-color { |
| 189 | + $disabled-selected-border-color: var(--item-border-color); |
| 190 | + } |
| 191 | + |
| 192 | + //text and icon colors |
127 | 193 | @if not($item-text-color) and $item-background {
|
128 |
| - @if meta.type-of($item-background) == 'color' { |
129 |
| - $item-text-color: text-contrast($item-background); |
130 |
| - } |
| 194 | + $item-text-color: adaptive-contrast(var(--item-background)); |
131 | 195 | }
|
132 | 196 |
|
133 |
| - @if not($item-hover-text-color) and $item-hover-background { |
134 |
| - @if meta.type-of($item-hover-background) == 'color' { |
135 |
| - $item-hover-text-color: text-contrast($item-hover-background); |
136 |
| - } |
| 197 | + @if not($item-icon-color) and $item-text-color { |
| 198 | + $item-icon-color: var(--item-text-color); |
137 | 199 | }
|
138 | 200 |
|
139 |
| - @if not($item-selected-background) and $item-background { |
140 |
| - @if meta.type-of($item-background) == 'color' { |
141 |
| - $item-selected-background: text-contrast($item-background); |
142 |
| - } |
| 201 | + @if not($item-hover-text-color) and $item-hover-background { |
| 202 | + $item-hover-text-color: adaptive-contrast(var(--item-hover-background)); |
143 | 203 | }
|
144 | 204 |
|
145 |
| - @if not($idle-shadow-color) and $selected-shadow-color { |
146 |
| - @if meta.type-of($selected-shadow-color) == 'color' { |
147 |
| - $idle-shadow-color: $selected-shadow-color; |
148 |
| - } |
| 205 | + @if not($item-hover-icon-color) and $item-hover-text-color { |
| 206 | + $item-hover-icon-color: var(--item-hover-text-color); |
149 | 207 | }
|
150 | 208 |
|
151 |
| - @if not($selected-shadow-color) and $idle-shadow-color { |
152 |
| - @if meta.type-of($idle-shadow-color) == 'color' { |
153 |
| - $selected-shadow-color: $idle-shadow-color; |
154 |
| - } |
| 209 | + @if not($item-focused-text-color) and $item-focused-background { |
| 210 | + $item-focused-text-color: adaptive-contrast(var(--item-focused-background)); |
155 | 211 | }
|
156 | 212 |
|
157 | 213 | @if not($item-selected-text-color) and $item-selected-background {
|
158 |
| - @if meta.type-of($item-selected-background) == 'color' { |
159 |
| - $item-selected-text-color: text-contrast($item-selected-background); |
160 |
| - } |
| 214 | + $item-selected-text-color: adaptive-contrast(var(--item-selected-background)); |
| 215 | + } |
| 216 | + |
| 217 | + @if not($item-selected-icon-color) and $item-selected-text-color { |
| 218 | + $item-selected-icon-color: var(--item-selected-text-color); |
| 219 | + } |
| 220 | + |
| 221 | + @if not($item-selected-hover-text-color) and $item-selected-hover-background { |
| 222 | + $item-selected-hover-text-color: adaptive-contrast(var(--item-selected-hover-background)); |
| 223 | + } |
| 224 | + |
| 225 | + @if not($item-selected-hover-icon-color) and $item-selected-hover-text-color { |
| 226 | + $item-selected-hover-icon-color: var(--item-selected-hover-text-color); |
| 227 | + } |
| 228 | + |
| 229 | + @if not($disabled-text-color) and $disabled-background-color { |
| 230 | + $disabled-text-color: hsla(from adaptive-contrast(var(--disabled-background-color)) h s l / 0.4); |
| 231 | + } |
| 232 | + |
| 233 | + @if not($disabled-selected-text-color) and $disabled-text-color { |
| 234 | + $disabled-selected-text-color: var(--disabled-text-color); |
| 235 | + } |
| 236 | + |
| 237 | + @if not($idle-shadow-color) and $item-background { |
| 238 | + $idle-shadow-color: hsla(from var(--item-background) h s l / .5); |
| 239 | + } |
| 240 | + |
| 241 | + @if not($idle-shadow-color) and $selected-shadow-color { |
| 242 | + $idle-shadow-color: var(--selected-shadow-color); |
| 243 | + } |
| 244 | + |
| 245 | + @if not($selected-shadow-color) and $idle-shadow-color { |
| 246 | + $selected-shadow-color: var(--idle-shadow-color); |
161 | 247 | }
|
162 | 248 |
|
163 | 249 | @if map.get($button-group-schema, 'elevation') > 0 {
|
|
205 | 291 | border: $border,
|
206 | 292 | shadow: $shadow,
|
207 | 293 | idle-shadow-color: $idle-shadow-color,
|
208 |
| - selected-shadow-color: $selected-shadow-color, |
209 |
| - theme: map.get($schema, '_meta', 'theme'), |
210 |
| - _meta: map.merge(if($meta, $meta, ()), ( |
211 |
| - variant: map.get($schema, '_meta', 'theme') |
212 |
| - )), |
| 294 | + selected-shadow-color: $selected-shadow-color |
213 | 295 | ));
|
214 | 296 | }
|
215 | 297 |
|
|
223 | 305 | $group-items-margin: rem(10px, 16px);
|
224 | 306 | $outline-btn-indent: rem(2px);
|
225 | 307 |
|
226 |
| - $variant: map.get($theme, '_meta', 'variant'); |
| 308 | + $variant: map.get($theme, '_meta', 'theme'); |
227 | 309 | $bootstrap-theme: $variant == 'bootstrap';
|
228 | 310 | $indigo-theme: $variant == 'indigo';
|
229 | 311 | $group-item-min-width: map.get((
|
|
445 | 527 | @if $variant == 'bootstrap' {
|
446 | 528 | background: var-get($theme, 'item-background');
|
447 | 529 | z-index: 1;
|
| 530 | + box-shadow: 0 0 0 rem(4px) var-get($theme, 'idle-shadow-color'); |
448 | 531 |
|
449 | 532 | &:active {
|
450 | 533 | background: var-get($theme, 'item-hover-background');
|
|
691 | 774 | color: var-get($theme, 'item-selected-text-color');
|
692 | 775 | border-color: var-get($theme, 'item-selected-border-color');
|
693 | 776 | background: var-get($theme, 'item-selected-background');
|
| 777 | + box-shadow: 0 0 0 rem(4px) var-get($theme, 'selected-shadow-color'); |
694 | 778 |
|
695 | 779 | igx-icon {
|
696 | 780 | color: var-get($theme, 'item-selected-icon-color');
|
|
0 commit comments