Skip to content

Commit 8d62677

Browse files
authored
feat(time-picker): improve time-picker theme (#15712)
1 parent 85ee24f commit 8d62677

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

projects/igniteui-angular/src/lib/core/styles/components/time-picker/_time-picker-theme.scss

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,36 +71,57 @@
7171
}
7272

7373
$theme: digest-schema($time-picker-schema);
74-
$meta: map.get($theme, '_meta');
7574

7675
@if not($text-color) and $background-color {
77-
$text-color: text-contrast($background-color);
76+
$text-color: hsla(from adaptive-contrast(var(--background-color)) h s l / 0.7);
77+
}
78+
79+
@if not($hover-text-color) and $text-color {
80+
$hover-text-color: hsla(from var(--text-color) h s l / 1);
81+
}
82+
83+
@if not($header-background) and $selected-text-color {
84+
$header-background: var(--selected-text-color);
85+
}
86+
87+
@if not($header-background) and $background-color {
88+
$header-background: var(--background-color);
7889
}
7990

8091
@if not($header-hour-text-color) and $header-background {
81-
$header-hour-text-color: text-contrast($header-background);
92+
$header-hour-text-color: adaptive-contrast(var(--header-background));
8293
}
8394

8495
@if not($selected-text-color) and $active-item-background {
85-
$selected-text-color: text-contrast($active-item-background);
96+
$selected-text-color: var(--active-item-background);
97+
}
98+
99+
@if not($active-item-background) and $selected-text-color {
100+
$active-item-background: var(--selected-text-color);
86101
}
87102

88103
@if not($active-item-background) and $background-color {
89-
@if meta.type-of($background-color) == 'color' {
90-
$active-item-background: rgba(text-contrast($background-color), .12);
91-
}
104+
$active-item-background: hsla(from adaptive-contrast(var(--background-color)) h s l / .5);
105+
}
106+
107+
@if not($active-item-foreground) and $active-item-background {
108+
$active-item-foreground: hsla(from adaptive-contrast(var(--active-item-background)) h s l / 1);
109+
}
110+
111+
@if not($selected-text-color) and $background-color {
112+
$selected-text-color: adaptive-contrast(var(--background-color));
92113
}
93114

94115
@if not($disabled-text-color) and $disabled-item-background {
95-
@if meta.type-of($disabled-item-background) == 'color' {
96-
$disabled-text-color: rgba(text-contrast($disabled-item-background), .6);
97-
}
116+
$disabled-text-color: hsla(from adaptive-contrast(var(--disabled-item-background)) h s l / .6);
117+
}
118+
119+
@if not($border-color) and $background-color {
120+
$border-color: hsla(from adaptive-contrast(var(--background-color)) h s l / .6);
98121
}
99122

100123
@if not($divider-color) and $border-color {
101-
@if meta.type-of($border-color) == 'color' {
102-
$divider-color: $border-color;
103-
}
124+
$divider-color: var(--border-color);
104125
}
105126

106127
@if not($modal-shadow) {
@@ -133,10 +154,6 @@
133154
divider-color: $divider-color,
134155
time-item-size: $time-item-size,
135156
active-item-border-radius: $active-item-border-radius,
136-
theme: map.get($schema, '_meta', 'theme'),
137-
_meta: map.merge(if($meta, $meta, ()), (
138-
variant: map.get($schema, '_meta', 'theme')
139-
)),
140157
));
141158
}
142159

@@ -146,7 +163,7 @@
146163
@mixin time-picker($theme) {
147164
@include css-vars($theme);
148165

149-
$variant: map.get($theme, '_meta', 'variant');
166+
$variant: map.get($theme, '_meta', 'theme');
150167
$not-bootstrap-theme: $variant != 'bootstrap';
151168

152169
$picker-buttons-padding: map.get((

0 commit comments

Comments
 (0)