Skip to content

Commit 8fb30dd

Browse files
committed
refactor: use chip colors as centralised theme colors
1 parent 16bd98c commit 8fb30dd

File tree

5 files changed

+47
-16
lines changed

5 files changed

+47
-16
lines changed

packages/components/chip/src/styles/index.module.scss

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,37 @@
33
.root {
44
@include font-base;
55

6+
background-color: get-css-var(chip, background-color);
7+
color: get-css-var(chip, color);
68
padding: 4px 8px;
79
line-height: 18px;
810
font-size: 12px;
911
font-weight: 700;
10-
1112
display: inline-flex;
1213
border-radius: 8px;
1314
}
1415

1516
.neutral {
16-
background-color: #e2e8f0;
17-
color: #1a202c;
17+
@include define-css-var(chip, background-color, #e2e8f0);
18+
@include define-css-var(chip, color, #1a202c);
1819
}
1920

2021
.primary {
21-
background-color: get-color(highlight-primary-light);
22-
color: get-color(highlight-primary-dark);
22+
@include define-css-var(chip, background-color, get-color(highlight-primary-light));
23+
@include define-css-var(chip, color, get-color(highlight-primary-dark));
2324
}
2425

2526
.negative {
26-
background-color: #fed7d7;
27-
color: #9b2c2c;
27+
@include define-css-var(chip, background-color, get-color(status-negative-light));
28+
@include define-css-var(chip, color, get-color(status-negative-dark));
2829
}
2930

3031
.average {
31-
background-color: #feebc8;
32-
color: #9b2c2c;
32+
@include define-css-var(chip, background-color, get-color(status-average-light));
33+
@include define-css-var(chip, color, get-color(status-average-dark));
3334
}
3435

3536
.positive {
36-
background-color: #e2f2e3;
37-
color: #276749;
37+
@include define-css-var(chip, background-color, get-color(status-positive-light));
38+
@include define-css-var(chip, color, get-color(status-positive-dark));
3839
}

packages/components/theme/src/styles/_theme-type.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ $theme-type: (
1212
"neutral-500",
1313
"neutral-800",
1414
"neutral-900",
15+
"status-positive-light",
16+
"status-positive-dark",
17+
"status-average-light",
18+
"status-average-dark",
19+
"status-negative-light",
20+
"status-negative-dark",
1521
"overlay-light",
1622
"overlay-dark",
1723
),

packages/components/theme/src/themes/default.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ export const defaultTheme: Theme = {
1616
"neutral-500": "#808080",
1717
"neutral-800": "#323646",
1818
"neutral-900": "#1E2232",
19+
"status-positive-light": "#e2f2e3",
20+
"status-positive-dark": "#276749",
21+
"status-average-light": "#feebc8",
22+
"status-average-dark": "#9b5c2c",
23+
"status-negative-light": "#fed7d7",
24+
"status-negative-dark": "#9b2c2c",
1925
"overlay-light": "rgba(255,255,255, .2)",
2026
"overlay-dark": "rgba(0,0,0,.2)",
2127
},

packages/components/theme/src/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ export interface Theme {
1111
"neutral-500": string;
1212
"neutral-800": string;
1313
"neutral-900": string;
14+
"status-positive-light": string;
15+
"status-positive-dark": string;
16+
"status-average-light": string;
17+
"status-average-dark": string;
18+
"status-negative-light": string;
19+
"status-negative-dark": string;
1420
"overlay-light": string;
1521
"overlay-dark": string;
1622
};

packages/docs/pages/src/theme.mdx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,25 @@ These colors are carefully curated to maintain a cohesive and visually appealing
1717
)}
1818
/>
1919

20-
<ColorItem
21-
title="Neutral"
22-
subtitle="Multi purpose neutral colors"
20+
{" "}
21+
22+
<ColorItem
23+
title="Neutral"
24+
subtitle="Multi purpose neutral colors"
25+
colors={Object.fromEntries(
26+
Object.entries(defaultTheme.color).filter(([k]) => k.includes("neutral")),
27+
)}
28+
/>
29+
30+
<ColorItem
31+
title="Status Colors"
32+
subtitle="Colors used to refelect different statuses"
2333
colors={Object.fromEntries(
24-
Object.entries(defaultTheme.color).filter(([k]) => k.includes("neutral")),
34+
Object.entries(defaultTheme.color).filter(([k]) => k.includes("status")),
2535
)}
26-
/>
36+
37+
/>
38+
2739
<ColorItem
2840
title="Overlay"
2941
subtitle="Semi-opaque colors"

0 commit comments

Comments
 (0)