|
142 | 142 | $color-variants: map.get($hue-colors, $hue); |
143 | 143 |
|
144 | 144 | $prefix: if($hue == "subtle", "-subtle", ""); |
| 145 | + $name: "" + $color-name; |
145 | 146 |
|
146 | 147 | // TODO(FW-6417) this @if can be removed if we add subtle colors for ios and md |
147 | 148 | // Only proceed if the color variants exist |
|
156 | 157 | $foreground: map.get($color-variants, foreground); |
157 | 158 |
|
158 | 159 | // Generate CSS variables dynamically |
159 | | - --ion-color#{$prefix}-base: var(--ion-color-#{$color-name}#{$prefix}, #{$base}) !important; |
160 | | - --ion-color#{$prefix}-base-rgb: var(--ion-color-#{$color-name}#{$prefix}-rgb, #{$base-rgb}) !important; |
161 | | - --ion-color#{$prefix}-contrast: var(--ion-color-#{$color-name}#{$prefix}-contrast, #{$contrast}) !important; |
| 160 | + --ion-color#{$prefix}-base: var(--ion-color-#{$name}#{$prefix}, #{$base}) !important; |
| 161 | + --ion-color#{$prefix}-base-rgb: var(--ion-color-#{$name}#{$prefix}-rgb, #{$base-rgb}) !important; |
| 162 | + --ion-color#{$prefix}-contrast: var(--ion-color-#{$name}#{$prefix}-contrast, #{$contrast}) !important; |
162 | 163 | --ion-color#{$prefix}-contrast-rgb: var( |
163 | | - --ion-color-#{$color-name}#{$prefix}-contrast-rgb, |
| 164 | + --ion-color-#{$name}#{$prefix}-contrast-rgb, |
164 | 165 | #{$contrast-rgb} |
165 | 166 | ) !important; |
166 | | - --ion-color#{$prefix}-shade: var(--ion-color-#{$color-name}#{$prefix}-shade, #{$shade}) !important; |
167 | | - --ion-color#{$prefix}-tint: var(--ion-color-#{$color-name}#{$prefix}-tint, #{$tint}) !important; |
| 167 | + --ion-color#{$prefix}-shade: var(--ion-color-#{$name}#{$prefix}-shade, #{$shade}) !important; |
| 168 | + --ion-color#{$prefix}-tint: var(--ion-color-#{$name}#{$prefix}-tint, #{$tint}) !important; |
168 | 169 | // TODO(FW-6417): remove the fallback variable when the foreground variable is |
169 | 170 | // required by all palettes for all themes: |
170 | | - // --ion-color#{$prefix}-foreground: var(--ion-color-#{$color-name}#{$prefix}-foreground, #{$foreground}) !important; |
| 171 | + // --ion-color#{$prefix}-foreground: var(--ion-color-#{$name}#{$prefix}-foreground, #{$foreground}) !important; |
171 | 172 | --ion-color#{$prefix}-foreground: var( |
172 | | - --ion-color-#{$color-name}#{$prefix}-foreground, |
173 | | - var(--ion-color-#{$color-name}#{$prefix}, #{$foreground}) |
| 173 | + --ion-color-#{$name}#{$prefix}-foreground, |
| 174 | + var(--ion-color-#{$name}#{$prefix}, #{$foreground}) |
174 | 175 | ) !important; |
175 | 176 | } |
176 | 177 | } |
|
229 | 230 | } |
230 | 231 |
|
231 | 232 | @each $color-name, $value in $theme-colors { |
| 233 | + $name: "" + $color-name; |
| 234 | + |
232 | 235 | @each $hue in (bold, subtle) { |
233 | 236 | $colors: map.get($value, $hue); |
234 | 237 |
|
235 | 238 | @if $colors != null { |
236 | 239 | $prefix: if($hue == subtle, "-subtle", ""); |
237 | 240 |
|
238 | | - --ion-color-#{$color-name}#{$prefix}: #{map.get($colors, base)}; |
239 | | - --ion-color-#{$color-name}#{$prefix}-rgb: #{map.get($colors, base-rgb)}; |
240 | | - --ion-color-#{$color-name}#{$prefix}-contrast: #{map.get($colors, contrast)}; |
241 | | - --ion-color-#{$color-name}#{$prefix}-contrast-rgb: #{map.get($colors, contrast-rgb)}; |
242 | | - --ion-color-#{$color-name}#{$prefix}-shade: #{map.get($colors, shade)}; |
243 | | - --ion-color-#{$color-name}#{$prefix}-tint: #{map.get($colors, tint)}; |
| 241 | + --ion-color-#{$name}#{$prefix}: #{map.get($colors, base)}; |
| 242 | + --ion-color-#{$name}#{$prefix}-rgb: #{map.get($colors, base-rgb)}; |
| 243 | + --ion-color-#{$name}#{$prefix}-contrast: #{map.get($colors, contrast)}; |
| 244 | + --ion-color-#{$name}#{$prefix}-contrast-rgb: #{map.get($colors, contrast-rgb)}; |
| 245 | + --ion-color-#{$name}#{$prefix}-shade: #{map.get($colors, shade)}; |
| 246 | + --ion-color-#{$name}#{$prefix}-tint: #{map.get($colors, tint)}; |
244 | 247 | // TODO(FW-6417): this "if" can be removed when foreground is defined for ios/md |
245 | 248 | // themes. It should not be added until we want foreground to be required for |
246 | 249 | // ios and md because this will be a breaking change, requiring users to add |
247 | 250 | // `--ion-color-{color}-foreground` in order to override the default colors |
248 | 251 | @if (map.get($colors, foreground)) { |
249 | | - --ion-color-#{$color-name}#{$prefix}-foreground: #{map.get($colors, foreground)}; |
| 252 | + --ion-color-#{$name}#{$prefix}-foreground: #{map.get($colors, foreground)}; |
250 | 253 | } |
251 | 254 | } |
252 | 255 | } |
|
0 commit comments