From b5b7285e3843e1e376c21f85a237b8c36f8757cd Mon Sep 17 00:00:00 2001 From: Fabian Date: Mon, 29 Jul 2019 16:10:07 +0200 Subject: [PATCH] Add important elevations --- src/_maketheme.scss | 6 +++++- src/dark.scss | 11 +++++++++-- src/light.scss | 33 ++++++++++++++++++++++----------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/_maketheme.scss b/src/_maketheme.scss index ef3e42d..d06d2b2 100644 --- a/src/_maketheme.scss +++ b/src/_maketheme.scss @@ -20,7 +20,11 @@ $button-color: #CCCCCC !default; @each $dp in $elevations { .elv-#{$dp} { - @include Elevation($dp); + @include Elevation($dp, false); + } + + .elv-#{$dp}-imp { + @include Elevation($dp, true); } } diff --git a/src/dark.scss b/src/dark.scss index e15db0f..c3d9b5f 100644 --- a/src/dark.scss +++ b/src/dark.scss @@ -4,8 +4,15 @@ $background: #000000; $on-background: white; $disabled-brightness: 1.1; -@mixin Elevation ($dp) { - background: lighten($background, 10% + floor($dp * .7%)); +@mixin Elevation ($dp, $imp:false) { + @if $imp==true { + background: lighten($background, 10% + floor($dp * .7%)) !important; + } + + @else { + background: lighten($background, 10% + floor($dp * .7%)); + } + z-index: $dp; } diff --git a/src/light.scss b/src/light.scss index ac1d17f..2fb6935 100644 --- a/src/light.scss +++ b/src/light.scss @@ -2,49 +2,60 @@ $background: #f9f9f9; $on-background: black; $disabled-brightness: .9; -@mixin Elevation ($dp) { +@mixin MakeShadow($imp, $type) { + @if $imp==true { + box-shadow: $type !important; + } + + @else { + box-shadow: $type; + } +} + +@mixin Elevation ($dp, $imp:false) { @if $dp==0 { + @include MakeShadow($imp, none); box-shadow: none } @else if $dp==1 { - box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12), 0 1px 3px 0 rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12), 0 1px 3px 0 rgba(0, 0, 0, .20))) // box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12), 0 1px 3px 0 rgba(0, 0, 0, .20) } @else if $dp==2 { - box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12), 0 1px 5px 0 rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12), 0 1px 5px 0 rgba(0, 0, 0, .20))) } @else if $dp==3 { - box-shadow: 0 3px 4px 0 rgba(0, 0, 0, .14), 0 3px 3px -2px rgba(0, 0, 0, .12), 0 1px 8px 0 rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 3px 4px 0 rgba(0, 0, 0, .14), 0 3px 3px -2px rgba(0, 0, 0, .12), 0 1px 8px 0 rgba(0, 0, 0, .20))) } @else if $dp==4 { - box-shadow: 0 4px 5px 0 rgba(0, 0, 0, .14), 0 1px 10px 0 rgba(0, 0, 0, .12), 0 2px 4px -1px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 4px 5px 0 rgba(0, 0, 0, .14), 0 1px 10px 0 rgba(0, 0, 0, .12), 0 2px 4px -1px rgba(0, 0, 0, .20))) } @else if $dp==6 { - box-shadow: 0 6px 10px 0 rgba(0, 0, 0, .14), 0 1px 18px 0 rgba(0, 0, 0, .12), 0 3px 5px -1px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 6px 10px 0 rgba(0, 0, 0, .14), 0 1px 18px 0 rgba(0, 0, 0, .12), 0 3px 5px -1px rgba(0, 0, 0, .20))) } @else if $dp==8 { - box-shadow: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0, .12), 0 5px 5px -3px rgba(0, 0, 0, .20))) } @else if $dp==9 { - box-shadow: 0 9px 12px 1px rgba(0, 0, 0, .14), 0 3px 16px 2px rgba(0, 0, 0, .12), 0 5px 6px -3px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 9px 12px 1px rgba(0, 0, 0, .14), 0 3px 16px 2px rgba(0, 0, 0, .12), 0 5px 6px -3px rgba(0, 0, 0, .20))) } @else if $dp==12 { - box-shadow: 0 12px 17px 2px rgba(0, 0, 0, .14), 0 5px 22px 4px rgba(0, 0, 0, .12), 0 7px 8px -4px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 12px 17px 2px rgba(0, 0, 0, .14), 0 5px 22px 4px rgba(0, 0, 0, .12), 0 7px 8px -4px rgba(0, 0, 0, .20))) } @else if $dp==16 { - box-shadow: 0 16px 24px 2px rgba(0, 0, 0, .14), 0 6px 30px 5px rgba(0, 0, 0, .12), 0 8px 10px -5px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 16px 24px 2px rgba(0, 0, 0, .14), 0 6px 30px 5px rgba(0, 0, 0, .12), 0 8px 10px -5px rgba(0, 0, 0, .20))) } @else if $dp==24 { - box-shadow: 0 24px 38px 3px rgba(0, 0, 0, .14), 0 9px 46px 8px rgba(0, 0, 0, .12), 0 11px 15px -7px rgba(0, 0, 0, .20) + @include MakeShadow($imp, (0 24px 38px 3px rgba(0, 0, 0, .14), 0 9px 46px 8px rgba(0, 0, 0, .12), 0 11px 15px -7px rgba(0, 0, 0, .20))) } @else {