Skip to content

Commit 547877c

Browse files
committed
feat: Improved Dark Mode using Raising Elevation
Closes #860
1 parent 2c3ea5e commit 547877c

File tree

32 files changed

+588
-152
lines changed

32 files changed

+588
-152
lines changed

packages/alert/src/_mixins.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
/// internally.
6363
@mixin rmd-toast {
6464
@include rmd-elevation($rmd-toast-elevation);
65+
@include rmd-theme-dark-elevation($rmd-toast-elevation);
6566
@include rmd-typography(subtitle-2);
6667
@include rmd-alert-theme(background-color);
6768
@include rmd-alert-theme(color);

packages/card/src/_mixins.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363
&--shadowed {
6464
@include rmd-elevation($rmd-card-elevation);
65+
@include rmd-theme-dark-elevation($rmd-card-elevation);
6566
}
6667

6768
&--bordered {

packages/chip/src/_variables.scss

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,14 @@ $rmd-chip-solid-light-disabled-background-color: $rmd-grey-100 !default;
116116
/// theme.
117117
///
118118
/// @require $rmd-grey-900
119+
/// @require $rmd-theme-dark-elevation
120+
/// @require $rmd-theme-dark-elevation-colors
119121
/// @type Color
120-
$rmd-chip-solid-dark-background-color: $rmd-grey-900 !default;
122+
$rmd-chip-solid-dark-background-color: if(
123+
$rmd-theme-dark-elevation,
124+
map-get($rmd-theme-dark-elevation-colors, 12),
125+
$rmd-grey-900
126+
) !default;
121127

122128
/// The text color to use for "solid" themed chips when using the dark theme.
123129
///
@@ -191,9 +197,15 @@ $rmd-chip-outline-light-color: if(
191197
/// The background color to use for "outlined" themed chips when using the dark
192198
/// theme.
193199
///
200+
/// @require $rmd-theme-dark-elevation
201+
/// @require $rmd-theme-dark-elevation-colors
194202
/// @require $rmd-theme-dark-surface
195203
/// @type Color
196-
$rmd-chip-outline-dark-background-color: $rmd-theme-dark-surface !default;
204+
$rmd-chip-outline-dark-background-color: if(
205+
$rmd-theme-dark-elevation,
206+
map-get($rmd-theme-dark-elevation-colors, 8),
207+
$rmd-theme-dark-surface
208+
) !default;
197209

198210
/// The text color to use for "outlined" themed chips when using the dark theme.
199211
///

packages/dialog/src/_mixins.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
/// @access private
4141
@mixin rmd-dialog {
4242
@include rmd-elevation($rmd-dialog-elevation);
43+
@include rmd-theme-dark-elevation($rmd-dialog-elevation);
4344
@include rmd-theme-update-var(background, rmd-theme-var(surface));
4445
@include rmd-theme(background-color, background);
4546
@include rmd-theme(color, text-primary-on-background);

packages/documentation/src/_variables.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
$rmd-theme-primary: $rmd-teal-500;
44
$rmd-theme-secondary: $rmd-pink-a-200;
5+
$rmd-theme-dark-elevation: true;
56
$rmd-utils-auto-dense: true;
67

8+
@import '~@react-md/theme/dist/variables';
9+
710
$code-light-theme-bg: $rmd-grey-200;
8-
$code-dark-theme-bg: #171717;
11+
$code-dark-theme-bg: map-get($rmd-theme-dark-elevation-colors, 4);
912
$solarized-base-03: #002b36;
1013
$solarized-base-02: #073642;
1114
$solarized-base-01: #586e75;

packages/documentation/src/components/ColorsAndTheming/ThemeBuilder/Preview.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
$rmd-theme-dark-elevation: true;
2+
13
@import '~@react-md/elevation/dist/mixins';
4+
@import '~@react-md/theme/dist/mixins';
25

36
.container {
47
@include rmd-elevation(6);
8+
@include rmd-theme-dark-elevation(6, true);
59

610
height: 25rem;
711
overflow: hidden;

packages/documentation/src/components/Demos/AppBar/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const demos = [
2323
name: "Simple Usage",
2424
description: simpleUsage,
2525
children: <SimpleUsage />,
26+
disableCard: true,
2627
},
2728
{
2829
name: "Different Sizes",

packages/documentation/src/components/Demos/Demo.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$rmd-theme-dark-elevation: true;
2+
13
@import '~@react-md/app-bar/dist/mixins';
24
@import '~@react-md/divider/dist/mixins';
35
@import '~@react-md/elevation/dist/mixins';
@@ -52,6 +54,7 @@ $demo-padding-extra: 6rem;
5254

5355
.preview {
5456
@include rmd-elevation(2);
57+
@include rmd-theme-dark-elevation(2, true);
5558
@include rmd-theme(background-color, background);
5659
@include rmd-theme-update-var(background, rmd-theme-var(surface));
5760
@include rmd-app-bar-theme-update-var(color, rmd-theme-var(on-surface));

packages/documentation/src/components/Demos/Divider/Container.module.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1+
$rmd-theme-dark-elevation: true;
2+
13
@import '~@react-md/elevation/dist/mixins';
4+
@import '~@react-md/theme/dist/mixins';
5+
@import '~@react-md/utils/dist/mixins';
26

37
.container {
8+
@include rmd-utils-optional-css-modules('.rmd-list', true, false) {
9+
@include rmd-theme-dark-elevation(6, true);
10+
}
11+
412
:global .rmd-list {
5-
@include rmd-elevation(2);
13+
@include rmd-elevation(4);
614

715
margin: 2rem auto;
816
max-width: 25rem;

packages/documentation/src/components/Demos/Elevation/AllElevations.module.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
$rmd-theme-dark-elevation: true;
2+
13
@import '~@react-md/elevation/dist/mixins';
24
@import '~@react-md/list/dist/mixins';
35
@import '~@react-md/theme/dist/mixins';
@@ -24,6 +26,7 @@
2426
@for $i from 0 through 24 {
2527
.elevation#{$i} {
2628
@include rmd-elevation($i);
29+
@include rmd-theme-dark-elevation($i);
2730
}
2831
}
2932

0 commit comments

Comments
 (0)