Skip to content

Commit f125387

Browse files
authored
Merge pull request #7617 from IgniteUI/simeonoff/indigo-theme
feat(themes): add initial indigo theme
2 parents 34d8b70 + b90ca15 commit f125387

File tree

217 files changed

+5953
-1772
lines changed

Some content is hidden

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

217 files changed

+5953
-1772
lines changed

.sassdocrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
"theme": "./node_modules/igniteui-sassdoc-theme/sassdoc/",
1010
"autofill": ["throws", "content"],
1111
"groups": {
12+
"global-themes": "Global Themes",
13+
"component-themes": "Component Themes",
1214
"undefined": "general"
1315
},
1416
"no-update-notifier": false,
1517
"verbose": false,
1618
"strict": false,
1719
"display": {
1820
"alias": true,
19-
"access": ["public", "private"]
21+
"access": ["public"]
2022
},
2123
"privatePrefix": true,
2224
"resolvedValue": true

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ All notable changes for each version of this project will be documented in this
2424
- `igxDatePicker`
2525
- Added new property - `editorTabIndex`, that allows setting tabindex for the default editor.
2626

27+
### New Theme
28+
Ignite UI for Angular now has a new theme based on our own design system.
29+
You can use one of the following mixins to include a dark or light indigo theme:
30+
`igx-indigo-light-theme` and `igx-indigo-dark-theme`
31+
32+
We also added two new palettes that go with the new theme, `$light-indigo-palette` and `$dark-indigo-palette`.
33+
34+
The following example shows how you can use the Indigo theme:
35+
36+
```scss
37+
// Light version
38+
.indigo-theme {
39+
@include igx-indigo-light-theme($light-indigo-palette);
40+
}
41+
42+
// Dark version
43+
.indigo-dark-theme {
44+
@include igx-indigo-dark-theme($dark-indigo-palette);
45+
}
46+
```
47+
2748
### New Features
2849
- `IgxGrid`, `IgxTreeGrid`, `IgxHierarchicalGrid`
2950
- Introduced `showSummaryOnCollapse` grid property which allows you to control whether the summary row stays visible when the groupBy / parent row is collapsed.
@@ -500,7 +521,7 @@ Ignite UI for angular now have a new theme that mimics Microsoft "Fluent" design
500521
Depending on your use case you can use one of the following mixins:
501522
`igx-fluent-theme` and `igx-fluent-dark-theme`
502523

503-
We also added two new pallets that go with the new theme, `$fluent-word-palette` and `$fluent-excel-palette`.
524+
We also added two new palettes that go with the new theme, `$fluent-word-palette` and `$fluent-excel-palette`.
504525

505526
Next example shows how you can use the Fluent theme.
506527

projects/igniteui-angular/src/lib/core/styles/base/elevations/_index.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,16 @@
150150

151151
@return $result;
152152
}
153+
154+
/// Default elevations.
155+
/// @type Map
156+
/// @prop {Color} $color-1 [rgba(0, 0, 0, .26)] - The color used for the umbra shadow.
157+
/// @prop {Color} $color-2 [rgba(0, 0, 0, .12)] - The color used for the penumbra shadow.
158+
/// @prop {Color} $color-3 [rgba(0, 0, 0, .08)] - The color used for the ambient shadow.
159+
/// @requires igx-elevations
160+
$elevations: igx-elevations(
161+
rgba(0, 0, 0, .26),
162+
rgba(0, 0, 0, .12),
163+
rgba(0, 0, 0, .08)
164+
) !default;
165+

projects/igniteui-angular/src/lib/core/styles/base/utilities/_bem.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,62 +314,71 @@ $bem--sep-mod-val: if(variable-exists(bem--sep-mod-val), $bem--sep-mod-val, '-')
314314
}
315315

316316
/// @alias bem-selector
317+
/// @see bem-selector
317318
@mixin bem($block, $e: null, $elem: null, $m: null, $mod: null, $mods: null) {
318319
#{bem-selector($block, $e: $e, $elem: $elem, $m: $m, $mod: $mod, $mods: $mods)} {
319320
@content;
320321
}
321322
}
322323

323324
/// @alias bem-block
325+
/// @see bem-block
324326
@mixin block($block) {
325327
@include bem-block($block) {
326328
@content;
327329
}
328330
}
329331

330332
/// @alias bem-elem
333+
/// @see bem-elem
331334
@mixin elem($elem, $m: null, $mod: null, $mods: null) {
332335
@include bem-elem($elem, $m: $m, $mod: $mod, $mods: $mods) {
333336
@content;
334337
}
335338
}
336339

337340
/// @alias bem-mod
341+
/// @see bem-mod
338342
@mixin mod($mod) {
339343
@include bem-mod($mod) {
340344
@content;
341345
}
342346
}
343347

344348
/// @alias bem-mods
349+
/// @see bem-mods
345350
@mixin mods($mods...) {
346351
@include bem-mods($mods...) {
347352
@content;
348353
}
349354
}
350355

351356
/// @alias bem-block
357+
/// @see bem-block
352358
@mixin b($block) {
353359
@include bem-block($block) {
354360
@content;
355361
}
356362
}
357363

358364
/// @alias bem-elem
365+
/// @see bem-elem
359366
@mixin e($elem, $m: null, $mod: null, $mods: null) {
360367
@include bem-elem($elem, $m: $m, $mod: $mod, $mods: $mods) {
361368
@content;
362369
}
363370
}
364371

365372
/// @alias bem-mod
373+
/// @see bem-mod
366374
@mixin m($mod) {
367375
@include bem-mod($mod) {
368376
@content;
369377
}
370378
}
371379

372380
/// @alias bem-mods
381+
/// @see bem-mods
373382
@mixin mx($mods...) {
374383
@include bem-mods($mods...) {
375384
@content;

projects/igniteui-angular/src/lib/core/styles/base/utilities/_functions.scss

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,51 @@
143143
@return $rgba;
144144
}
145145

146+
/// Converts a rgba color to a hexidecimal color.
147+
///
148+
/// An alias of hexrgba.
149+
/// @access public
150+
/// @alias hexrgba
151+
/// @see hexrgba
152+
@function to-opaque($rgba, $background: #fff) {
153+
@return hexrgba($rgba, $background);
154+
}
155+
146156
/// Returns a contrast color for a passed color.
147157
/// @access public
148158
/// @group Palettes
149-
/// @param {Color} $color - The color used to return a contrast color for.
159+
/// @param {Color} $background - The background color used to return a contrast/forground color for.
160+
/// @param {Color} $foreground - The foreground color used in case it has enough contrast against the provided background.
161+
/// @param {String} $contrast - The contrast level according to WCAG 2.0 standards.
150162
/// @returns {Color} - Returns either white or black depending on the luminance of the input color.
151-
@function text-contrast($color) {
152-
@if type-of($color) == 'color' {
153-
$lightContrast: contrast($color, white);
154-
$darkContrast: contrast($color, black);
163+
/// @link https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
164+
@function text-contrast($background, $foreground: white, $contrast: 'AAA') {
165+
@if type-of($foreground) == 'color' and type-of($background) == 'color' {
166+
$level: map-get((
167+
'A': 3,
168+
'AA': 4.5,
169+
'AAA': 7
170+
), $contrast);
171+
172+
@if $level == null {
173+
@error "$contrast must be 'A', 'AA', or 'AAA'";
174+
}
155175

156-
@if ($lightContrast > $darkContrast) {
157-
@return white;
176+
@if contrast($background, $foreground) >= $level {
177+
@return $foreground;
158178
} @else {
159-
@return black;
179+
$lightContrast: contrast($background, white);
180+
$darkContrast: contrast($background, black);
181+
182+
@if ($lightContrast > $darkContrast) {
183+
@return white;
184+
} @else {
185+
@return black;
186+
}
160187
}
188+
} @else {
189+
@error 'Expected color for $background/$foreground but got #{$background}/#{$foreground}';
161190
}
162-
@return $color;
163191
}
164192

165193
/// Retrieves a contrast text color for a given color from a color palette.
@@ -171,7 +199,7 @@
171199
/// @requires igx-color
172200
/// @requires text-contrast
173201
/// @requires hexrgba
174-
/// @returns {Color} [#fff] - Returns white if now palette, color and/or variant matches found.
202+
/// @returns {Color} [#fff] - Returns white if no palette, color and/or variant matches found.
175203
@function igx-contrast-color($palette, $color, $variant: 500) {
176204
$_color: igx-color($palette, $color, $variant);
177205
@if $_color {
@@ -249,7 +277,7 @@
249277
}
250278

251279
/// Extends a Map object with the properties of another Map object.
252-
/// @access private
280+
/// @access public
253281
/// @param {Map...} $maps - The source map to get extended.
254282
/// @returns {Map} - Returns the merged maps.
255283
@function extend($maps...) {
@@ -311,6 +339,7 @@
311339
/// @param {Color} $error [#ff134a] - The error color used throughout the application.
312340
/// @param {Color} $grays [#000 | $igx-foreground-color] - The color used for generating the grays palette.
313341
/// @param {Color} $surface [#fff] - The color used as a background in components, such as cards, sheets, and menus.
342+
/// @param {String} $variant ['material'] - The palette variant that gets generated. Possible values are: 'material', 'fluent', 'bootstrap', and 'indigo-design'.
314343
/// @returns {Map} - A map consisting of 74 color variations, including the `primary`, `secondary`, `grays`,
315344
/// `info`, `success`, `warn`, and `error` colors.
316345
@function igx-palette(
@@ -321,10 +350,17 @@
321350
$warn: #fbb13c,
322351
$error: #ff134a,
323352
$grays: #000,
324-
$surface: #fff
353+
$surface: #fff,
354+
$variant: 'material'
325355
) {
326356
$saturations: (50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 'A100', 'A200', 'A400', 'A700');
327-
$shades: (50: .02, 100: .04, 200: .08, 300: .12, 400: .26, 500: .38, 600: .54, 700: .62, 800: .74, 900: .87);
357+
358+
$shades: map-get((
359+
'material': (50: .02, 100: .04, 200: .08, 300: .12, 400: .26, 500: .38, 600: .54, 700: .62, 800: .74, 900: .87),
360+
'fluent': (50: .02, 100: .04, 200: .08, 300: .12, 400: .26, 500: .38, 600: .54, 700: .62, 800: .74, 900: .87),
361+
'bootstrap': (50: .02, 100: .04, 200: .08, 300: .12, 400: .26, 500: .38, 600: .54, 700: .62, 800: .74, 900: .87),
362+
'indigo-design': (50: .02, 100: .03, 200: .06, 300: .15, 400: .21, 500: .4, 600: .52, 700: .64, 800: .77, 900: .9),
363+
), $variant);
328364

329365
$primary-palette: generate-palette($primary, $saturations);
330366
$secondary-palette: generate-palette($secondary, $saturations);
@@ -420,6 +456,8 @@
420456
@if function-exists($fn) {
421457
@if $result == null and ($fn == 'igx-color' or $fn == 'igx-contrast-color') {
422458
$result: call(get-function($fn), $extra, $args...);
459+
} @else if ($fn == 'hexrgba' or $fn == 'to-opaque') and type-of($args) == 'map' {
460+
$result: call(get-function($fn), $result, resolve-value($ctx: $args, $extra: $extra));
423461
} @else if $result != null {
424462
$result: call(get-function($fn), $result, $args...);
425463
} @else {

projects/igniteui-angular/src/lib/core/styles/components/action-strip/_action-strip-theme.scss

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
compact: 0 rem(12px)
7878
);
7979

80+
$variant: map-get($theme, variant);
81+
8082
$left: if-ltr(left, right);
8183
$right: if-ltr(right, left);
8284

@@ -109,14 +111,14 @@
109111
}
110112
}
111113

112-
%igx-action-strip--cosy{
113-
padding: map-get($padding, 'cosy');
114+
%igx-action-strip--cosy {
114115
@extend %action-icons-density;
116+
padding: map-get($padding, 'cosy');
115117
}
116118

117-
%igx-action-strip--compact{
118-
padding: map-get($padding, 'compact');
119+
%igx-action-strip--compact {
119120
@extend %action-icons-density;
121+
padding: map-get($padding, 'compact');
120122
}
121123

122124
%igx-action-strip__editing-actions,
@@ -144,6 +146,12 @@
144146
igx-icon {
145147
color: --var($theme, 'color');
146148
}
149+
150+
[igxButton='icon'] {
151+
@if $variant == 'indigo-design' {
152+
border-radius: --var($theme, 'actions-border-radius');
153+
}
154+
}
147155
}
148156

149157
%igx-action-strip__pining-actions {

projects/igniteui-angular/src/lib/core/styles/components/avatar/_avatar-theme.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,21 @@
9494
material: null,
9595
fluent: null,
9696
bootstrap: 0 0 0 rem(3px) --var($theme, 'icon-background'),
97+
indigo-design: null,
9798
), $variant);
9899

99100
$box-shadow-initials: map-get((
100101
material: null,
101102
fluent: null,
102103
bootstrap: 0 0 0 rem(3px) --var($theme, 'initials-background'),
104+
indigo-design: null,
103105
), $variant);
104106

105107
$box-shadow-image: map-get((
106108
material: null,
107109
fluent: null,
108110
bootstrap: 0 0 0 rem(3px) --var($theme, 'image-background'),
111+
indigo-design: null,
109112
), $variant);
110113

111114
%_igx-avatar-outline {

0 commit comments

Comments
 (0)