Switching to different style of theme selection

This commit is contained in:
Fabian Stamm
2020-03-27 11:04:50 +01:00
parent 2835b1bac9
commit 67478113cb
15 changed files with 326 additions and 282 deletions

View File

@ -1,6 +1,7 @@
@import "./_vals.scss";
$ns: "" !default;
$name: false !default;
$background: false !default;
$on-background: false !default;
@ -11,26 +12,31 @@ $on-button: #000000 !default;
@error ("background and on-background must be set!");
}
:root {
@if $name==false {
@error ("name must be set!");
}
$theme: #{$name}-theme;
::root {
--background: #{$background};
--on-background: #{$on-background};
}
.background-default {
.#{$theme} .background-default {
background: $background;
}
@each $dp in $elevations {
.elv-#{$dp} {
.#{$theme} .elv-#{$dp} {
@include Elevation($dp, false);
}
.elv-#{$dp}-imp {
.#{$theme} .elv-#{$dp}-imp {
@include Elevation($dp, true);
}
}
.elv-transition {
.#{$theme} .elv-transition {
@include ElevationTransition();
}

3
src/build-pref.scss Normal file
View File

@ -0,0 +1,3 @@
$ns: "ht-";
@import "./build.scss";

5
src/build.scss Normal file
View File

@ -0,0 +1,5 @@
@import "./base.scss";
@import "./light.scss";
@import "./dark.scss";

View File

@ -18,4 +18,6 @@ $disabled-brightness: 1.1;
transition: background $time;
}
$name: "dark";
@import "./_maketheme.scss";

View File

@ -23,7 +23,7 @@ $disabled-brightness: 0.9;
0 1px 3px 0 rgba(0, 0, 0, 0.2)
)
)
// 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);
// 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 {
@include MakeShadow(
$imp,
@ -116,4 +116,6 @@ $disabled-brightness: 0.9;
transition: box-shadow $time;
}
$name: "light";
@import "./_maketheme.scss";

View File

@ -13,11 +13,11 @@
}
}
.btn-flat {
.#{$theme} .#{$ns}btn-flat {
@include btn-flat();
}
.#{$ns}btn {
.#{$theme} .#{$ns}btn {
@include Elevation(1);
@include ElevationTransition(0.2s);
&:focus {
@ -26,7 +26,7 @@
@include btn-flat();
}
.#{$ns}fab {
.#{$theme} .#{$ns}fab {
@include Elevation(8);
@include ElevationTransition(0.2s);
&:focus {

View File

@ -1,7 +1,7 @@
.#{$ns}card {
.#{$theme} .#{$ns}card {
@include Elevation(3);
}
.#{$ns}card-elevated {
.#{$theme} .#{$ns}card-elevated {
@include Elevation(8);
}

View File

@ -1,5 +1,4 @@
html,
body {
.#{$theme} {
background: $background;
color: $on-background;
}
}

View File

@ -1,3 +1,3 @@
.#{$ns}header {
.#{$theme} .#{$ns}header {
@include Elevation(3);
}

View File

@ -1,4 +1,4 @@
.#{$ns}inp {
.#{$theme} .#{$ns}inp {
color: $on-background;
option {
@ -7,13 +7,13 @@
}
}
.#{$ns}input-group {
.#{$theme} .#{$ns}input-group {
input {
@extend .#{$ns}inp;
}
}
.#{$ns}input-checkbox {
.#{$theme} .#{$ns}input-checkbox {
span {
background-color: $button-color;
}

View File

@ -1,9 +1,9 @@
.#{$ns}list-clickable {
.#{$theme} .#{$ns}list-clickable {
li:hover {
background: darken-brighten-color($background, 5%);
}
}
.#{$ns}list-selected {
.#{$theme} .#{$ns}list-selected {
background: darken-brighten-color($background, 10%);
}

View File

@ -1,4 +1,4 @@
.#{$ns}modal {
.#{$theme} .#{$ns}modal {
background: $background;
@include Elevation(24);

View File

@ -1,4 +1,4 @@
.#{$ns}table {
.#{$theme} .#{$ns}table {
tr:nth-child(odd):not(:first-child) {
background: darken-brighten-color($background, 10%);
}