Skip to content

Commit 25e765d

Browse files
feat(core): add ionic colors (#29707)
Co-authored-by: Brandy Carney <[email protected]>
1 parent 476a6ac commit 25e765d

File tree

132 files changed

+783
-96
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+783
-96
lines changed

core/src/components/badge/badge.common.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@use "../../themes/functions.color" as color;
12
@import "../../themes/mixins";
23
@import "./badge.common.vars";
34

@@ -43,8 +44,8 @@
4344
}
4445

4546
:host(.ion-color) {
46-
background: #{current-color(base)};
47-
color: #{current-color(contrast)};
47+
background: #{color.current-color(base)};
48+
color: #{color.current-color(contrast)};
4849
}
4950

5051
:host(:empty) {

core/src/components/badge/badge.ionic.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
// --------------------------------------------------
66

77
:host {
8-
// TODO(ROU-10872): replace this value the color function
9-
--background: #{globals.$ionic-color-blue-700};
10-
// TODO(ROU-10872): replace this value the color function
11-
--color: #{globals.$ionic-color-base-white};
8+
--background: #{globals.ion-color(primary, base)};
9+
--color: #{globals.ion-color(primary, contrast)};
1210
--padding-start: #{globals.$ionic-space-200};
1311
--padding-end: #{globals.$ionic-space-200};
1412
--padding-top: #{globals.$ionic-space-0};

core/src/components/badge/test/basic/badge.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4-
configs().forEach(({ config, screenshot, title }) => {
4+
configs({ modes: ['md', 'ios', 'ionic-md'] }).forEach(({ config, screenshot, title }) => {
55
test.describe(title('badge: rendering'), () => {
66
test('should not have visual regressions', async ({ page }) => {
77
await page.goto('/src/components/badge/test/basic', config);
63.5 KB
84.8 KB
60.8 KB
63.4 KB
84.5 KB
60.6 KB

core/src/components/button/button.ionic.scss

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,29 @@
6969
}
7070
}
7171

72+
// Button Colors
73+
// --------------------------------------------------
74+
75+
// Solid Button with Color
76+
:host(.button-solid.ion-color) .button-native {
77+
background: globals.current-color(base);
78+
color: globals.current-color(contrast);
79+
}
80+
81+
// Outline Button with Color
82+
:host(.button-outline.ion-color) .button-native {
83+
border-color: globals.current-color(base);
84+
85+
background: transparent;
86+
color: globals.current-color(base);
87+
}
88+
89+
// Clear Button with Color
90+
:host(.button-clear.ion-color) .button-native {
91+
background: transparent;
92+
color: globals.current-color(base);
93+
}
94+
7295
// Button Sizes
7396
// -------------------------------------------------------------------------------
7497

@@ -231,6 +254,32 @@
231254
--background-hover: #{globals.$ionic-color-neutral-100};
232255
}
233256

257+
/**
258+
* Only allow overriding of opacity here
259+
* as developers should not be overriding
260+
* colors when using the color prop.
261+
*/
262+
263+
:host(.button-solid.ion-color.ion-focused) .button-native::after {
264+
background: #{current-color(contrast)};
265+
}
266+
267+
:host(.button-clear.ion-color.ion-focused) .button-native::after,
268+
:host(.button-outline.ion-color.ion-focused) .button-native::after {
269+
background: #{current-color(base)};
270+
}
271+
272+
@media (any-hover: hover) {
273+
:host(.button-solid.ion-color:hover) .button-native::after {
274+
background: #{current-color(contrast)};
275+
}
276+
277+
:host(.button-clear.ion-color:hover) .button-native::after,
278+
:host(.button-outline.ion-color:hover) .button-native::after {
279+
background: #{current-color(base)};
280+
}
281+
}
282+
234283
// Button: Disabled
235284
// --------------------------------------------------
236285

@@ -257,9 +306,9 @@
257306

258307
// Default Outline Color
259308
:host(.button-outline) {
260-
--border-color: #{globals.$ionic-color-primary-base};
309+
--border-color: #{globals.ion-color(primary, base)};
261310
--background: #{globals.$ionic-color-base-white};
262-
--color: #{globals.$ionic-color-primary-base};
311+
--color: #{globals.ion-color(primary, base)};
263312
}
264313

265314
// Clear Button

0 commit comments

Comments
 (0)