From 8209a2fb5e2d5af8e738ddaf00afa0b702363f15 Mon Sep 17 00:00:00 2001 From: Daniel <50356015+danny007in@users.noreply.github.com> Date: Tue, 13 Apr 2021 17:54:31 +0530 Subject: [PATCH 1/5] feat: light mode only alt css To reduce file size --- build/scss/_alerts.scss | 2 +- build/scss/_buttons.scss | 2 +- build/scss/_callout.scss | 2 +- build/scss/_cards.scss | 2 +- build/scss/_colors.scss | 2 +- build/scss/_direct-chat.scss | 2 +- build/scss/_dropdown.scss | 2 +- build/scss/_forms.scss | 2 +- build/scss/_info-box.scss | 2 +- build/scss/_layout.scss | 2 +- build/scss/_main-sidebar.scss | 2 +- build/scss/_miscellaneous.scss | 2 +- build/scss/_mixins.scss | 1 + build/scss/_modals.scss | 2 +- build/scss/_navs.scss | 2 +- build/scss/_pagination.scss | 2 +- build/scss/_preloader.scss | 2 +- build/scss/_products.scss | 2 +- build/scss/_progress-bars.scss | 2 +- build/scss/_root.scss | 2 +- build/scss/_table.scss | 2 +- build/scss/_text.scss | 2 +- build/scss/_timeline.scss | 2 +- build/scss/_toasts.scss | 2 +- build/scss/_users-list.scss | 2 +- build/scss/_variables.scss | 6 ++++++ build/scss/mixins/_accent.scss | 14 ++++++++------ build/scss/mixins/_dark-mode.scss | 11 +++++++++++ build/scss/pages/_invoice.scss | 2 +- build/scss/pages/_lockscreen.scss | 2 +- build/scss/pages/_login_and_register.scss | 2 +- build/scss/pages/_profile.scss | 2 +- build/scss/parts/adminlte.light.scss | 16 ++++++++++++++++ 33 files changed, 70 insertions(+), 34 deletions(-) create mode 100644 build/scss/mixins/_dark-mode.scss create mode 100644 build/scss/parts/adminlte.light.scss diff --git a/build/scss/_alerts.scss b/build/scss/_alerts.scss index e882666a5..c5c95f0e9 100644 --- a/build/scss/_alerts.scss +++ b/build/scss/_alerts.scss @@ -35,7 +35,7 @@ } } -.dark-mode { +@include dark-mode () { @each $color, $value in $theme-colors-alt { .alert-#{$color} { color: color-yiq($value); diff --git a/build/scss/_buttons.scss b/build/scss/_buttons.scss index 362e7800b..4bb2b7e51 100644 --- a/build/scss/_buttons.scss +++ b/build/scss/_buttons.scss @@ -113,7 +113,7 @@ @include button-size($button-padding-y-xs, $button-padding-x-xs, $button-font-size-xs, $button-line-height-xs, $button-border-radius-xs); } -.dark-mode { +@include dark-mode () { .btn-default, .btn-app { background-color: lighten($dark, 2.5%); diff --git a/build/scss/_callout.scss b/build/scss/_callout.scss index 9e1877ad6..ffec5d765 100644 --- a/build/scss/_callout.scss +++ b/build/scss/_callout.scss @@ -50,7 +50,7 @@ } } -.dark-mode { +@include dark-mode () { .callout { background-color: lighten($dark, 5%); diff --git a/build/scss/_cards.scss b/build/scss/_cards.scss index d816e1177..7e81e7ac8 100644 --- a/build/scss/_cards.scss +++ b/build/scss/_cards.scss @@ -479,7 +479,7 @@ html.maximized-card { } } -.dark-mode { +@include dark-mode () { // Color variants @each $name, $color in $theme-colors-alt { diff --git a/build/scss/_colors.scss b/build/scss/_colors.scss index 107ba795d..36db20392 100644 --- a/build/scss/_colors.scss +++ b/build/scss/_colors.scss @@ -90,7 +90,7 @@ a.text-muted:hover { } } -.dark-mode { +@include dark-mode () { .bg-light { background-color: lighten($dark, 7.5%) !important; color: $white !important; diff --git a/build/scss/_direct-chat.scss b/build/scss/_direct-chat.scss index ce0321605..86c7079f4 100644 --- a/build/scss/_direct-chat.scss +++ b/build/scss/_direct-chat.scss @@ -223,7 +223,7 @@ } } -.dark-mode { +@include dark-mode () { .direct-chat-text { background-color: lighten($dark, 7.5%); border-color: lighten($dark, 10%); diff --git a/build/scss/_dropdown.scss b/build/scss/_dropdown.scss index 1cd1f95fe..a8e101401 100644 --- a/build/scss/_dropdown.scss +++ b/build/scss/_dropdown.scss @@ -244,7 +244,7 @@ } } -.dark-mode { +@include dark-mode () { .dropdown-menu { background-color: $dark; color: $white; diff --git a/build/scss/_forms.scss b/build/scss/_forms.scss index aa4377e40..f250cf72a 100644 --- a/build/scss/_forms.scss +++ b/build/scss/_forms.scss @@ -358,7 +358,7 @@ body.text-sm { } } -.dark-mode { +@include dark-mode () { .form-control:not(.form-control-navbar):not(.form-control-sidebar), .custom-select, .custom-file-label, diff --git a/build/scss/_info-box.scss b/build/scss/_info-box.scss index 1a636ca08..452e7b5bf 100644 --- a/build/scss/_info-box.scss +++ b/build/scss/_info-box.scss @@ -145,7 +145,7 @@ } } -.dark-mode { +@include dark-mode () { .info-box { background-color: $dark; color: $white; diff --git a/build/scss/_layout.scss b/build/scss/_layout.scss index 494ac239c..8b844dc2c 100644 --- a/build/scss/_layout.scss +++ b/build/scss/_layout.scss @@ -651,7 +651,7 @@ body:not(.layout-fixed) { } } -.dark-mode { +@include dark-mode () { background-color: $dark-main-bg; color: $white; diff --git a/build/scss/_main-sidebar.scss b/build/scss/_main-sidebar.scss index acd602c30..e6912f98a 100644 --- a/build/scss/_main-sidebar.scss +++ b/build/scss/_main-sidebar.scss @@ -1155,7 +1155,7 @@ } } -.dark-mode { +@include dark-mode () { @each $name, $color in $theme-colors-alt { .sidebar-dark-#{$name}, .sidebar-light-#{$name} { diff --git a/build/scss/_miscellaneous.scss b/build/scss/_miscellaneous.scss index 3fbd6cdb4..06ad37649 100644 --- a/build/scss/_miscellaneous.scss +++ b/build/scss/_miscellaneous.scss @@ -482,7 +482,7 @@ blockquote { padding: .375rem .6rem; } -.dark-mode { +@include dark-mode () { a:not(.btn):hover { color: lighten($link-color, 10%); } diff --git a/build/scss/_mixins.scss b/build/scss/_mixins.scss index 0de487cb4..a538db23a 100644 --- a/build/scss/_mixins.scss +++ b/build/scss/_mixins.scss @@ -10,6 +10,7 @@ @import "mixins/accent"; @import "mixins/custom-forms"; @import "mixins/backgrounds"; +@import "mixins/dark-mode"; @import "mixins/direct-chat"; @import "mixins/toasts"; @import "mixins/touch-support"; diff --git a/build/scss/_modals.scss b/build/scss/_modals.scss index 85188d864..d1452053f 100644 --- a/build/scss/_modals.scss +++ b/build/scss/_modals.scss @@ -43,7 +43,7 @@ } } -.dark-mode { +@include dark-mode () { .modal-header, .modal-footer { border-color: $gray-600; diff --git a/build/scss/_navs.scss b/build/scss/_navs.scss index 422e97571..5596cd11e 100644 --- a/build/scss/_navs.scss +++ b/build/scss/_navs.scss @@ -98,7 +98,7 @@ @include navbar-variant($color, $value); } -.dark-mode { +@include dark-mode () { .nav-pills .nav-link { color: $gray-400; } diff --git a/build/scss/_pagination.scss b/build/scss/_pagination.scss index 668ec9188..bd9df5a07 100644 --- a/build/scss/_pagination.scss +++ b/build/scss/_pagination.scss @@ -42,7 +42,7 @@ } } -.dark-mode { +@include dark-mode () { .page-item { &.disabled a, &.disabled .page-link { diff --git a/build/scss/_preloader.scss b/build/scss/_preloader.scss index 8752f5564..4c31c8412 100644 --- a/build/scss/_preloader.scss +++ b/build/scss/_preloader.scss @@ -14,7 +14,7 @@ z-index: $zindex-preloader; } -.dark-mode { +@include dark-mode () { .preloader { background-color: $dark-main-bg; color: $white; diff --git a/build/scss/_products.scss b/build/scss/_products.scss index b8fa0c07b..53d8fe896 100644 --- a/build/scss/_products.scss +++ b/build/scss/_products.scss @@ -55,7 +55,7 @@ } -.dark-mode { +@include dark-mode () { .products-list > .item { background-color: $dark; color: $white; diff --git a/build/scss/_progress-bars.scss b/build/scss/_progress-bars.scss index 763c626e2..044568f3a 100644 --- a/build/scss/_progress-bars.scss +++ b/build/scss/_progress-bars.scss @@ -65,7 +65,7 @@ } } -.dark-mode { +@include dark-mode () { .progress { background: lighten($dark, 7.5%); } diff --git a/build/scss/_root.scss b/build/scss/_root.scss index 4fb599623..69a60b055 100644 --- a/build/scss/_root.scss +++ b/build/scss/_root.scss @@ -1,4 +1,4 @@ -.dark-mode { +@include dark-mode () { :root { // Custom variable values only support SassScript inside `#{}`. @each $color, $value in $colors-alt { diff --git a/build/scss/_table.scss b/build/scss/_table.scss index 850d4cf8e..06ab53f58 100644 --- a/build/scss/_table.scss +++ b/build/scss/_table.scss @@ -123,7 +123,7 @@ } } -.dark-mode { +@include dark-mode () { .table-bordered { &, td, diff --git a/build/scss/_text.scss b/build/scss/_text.scss index 2c285b303..23764cfb8 100644 --- a/build/scss/_text.scss +++ b/build/scss/_text.scss @@ -38,7 +38,7 @@ } } -.dark-mode { +@include dark-mode () { .text-muted { color: $gray-500 !important; } diff --git a/build/scss/_timeline.scss b/build/scss/_timeline.scss index 3f59df407..efd3d8fa0 100644 --- a/build/scss/_timeline.scss +++ b/build/scss/_timeline.scss @@ -133,7 +133,7 @@ } } -.dark-mode { +@include dark-mode () { .timeline { &::before { background-color: $gray-600; diff --git a/build/scss/_toasts.scss b/build/scss/_toasts.scss index 34d2b393e..c20ae09e1 100644 --- a/build/scss/_toasts.scss +++ b/build/scss/_toasts.scss @@ -46,7 +46,7 @@ } } -.dark-mode { +@include dark-mode () { .toast { background-color: rgba($dark, .85); color: $white; diff --git a/build/scss/_users-list.scss b/build/scss/_users-list.scss index 543045c31..425c7a991 100644 --- a/build/scss/_users-list.scss +++ b/build/scss/_users-list.scss @@ -44,7 +44,7 @@ font-size: 12px; } -.dark-mode { +@include dark-mode () { .users-list-name { color: $gray-400; } diff --git a/build/scss/_variables.scss b/build/scss/_variables.scss index 4bf8e20a7..4bec008c1 100644 --- a/build/scss/_variables.scss +++ b/build/scss/_variables.scss @@ -240,3 +240,9 @@ $ribbon-xl-right: 4px !default; $custom-select-dark-indicator-color: $white !default; $custom-select-dark-indicator: url("data:image/svg+xml,") !default; $custom-select-dark-background: escape-svg($custom-select-dark-indicator) right $custom-select-padding-x center / $custom-select-bg-size no-repeat !default; // Used so we can have multiple background elements (e.g., arrow and feedback icon) + +// ENABLE DARK MODE +// -------------------------------------------------------- +$enable-dark-mode: true !default; // requires `@import "variables-alt";` + +// diff --git a/build/scss/mixins/_accent.scss b/build/scss/mixins/_accent.scss index b72e533bf..af53f7f68 100644 --- a/build/scss/mixins/_accent.scss +++ b/build/scss/mixins/_accent.scss @@ -91,12 +91,14 @@ } } } - .dark-mode.accent-#{$name} { - .page-item { - .page-link { - &:hover, - &:focus { - color: lighten($link-color, 5%); + @include dark-mode () { + .accent-#{$name} { + .page-item { + .page-link { + &:hover, + &:focus { + color: lighten($link-color, 5%); + } } } } diff --git a/build/scss/mixins/_dark-mode.scss b/build/scss/mixins/_dark-mode.scss new file mode 100644 index 000000000..7fce1e2cc --- /dev/null +++ b/build/scss/mixins/_dark-mode.scss @@ -0,0 +1,11 @@ +// +// Mixins: Dark Mode Controll +// + +@mixin dark-mode { + @if $enable-dark-mode { + .dark-mode { + @content; + } + } +} diff --git a/build/scss/pages/_invoice.scss b/build/scss/pages/_invoice.scss index 0affe2fc0..486ff7068 100644 --- a/build/scss/pages/_invoice.scss +++ b/build/scss/pages/_invoice.scss @@ -12,7 +12,7 @@ margin-top: 0; } -.dark-mode { +@include dark-mode () { .invoice { background-color: $dark; } diff --git a/build/scss/pages/_lockscreen.scss b/build/scss/pages/_lockscreen.scss index 20454e79e..300db8543 100644 --- a/build/scss/pages/_lockscreen.scss +++ b/build/scss/pages/_lockscreen.scss @@ -77,7 +77,7 @@ margin-top: 10px; } -.dark-mode { +@include dark-mode () { .lockscreen-item { background-color: $dark; } diff --git a/build/scss/pages/_login_and_register.scss b/build/scss/pages/_login_and_register.scss index d9c75af51..870bf5059 100644 --- a/build/scss/pages/_login_and_register.scss +++ b/build/scss/pages/_login_and_register.scss @@ -102,7 +102,7 @@ margin: 10px 0; } -.dark-mode { +@include dark-mode () { .login-card-body, .register-card-body { background-color: $dark; diff --git a/build/scss/pages/_profile.scss b/build/scss/pages/_profile.scss index 34afca993..dff2e1a19 100644 --- a/build/scss/pages/_profile.scss +++ b/build/scss/pages/_profile.scss @@ -36,7 +36,7 @@ } } -.dark-mode { +@include dark-mode () { .post { color: $white; border-color: $gray-600; diff --git a/build/scss/parts/adminlte.light.scss b/build/scss/parts/adminlte.light.scss new file mode 100644 index 000000000..1f7d0e347 --- /dev/null +++ b/build/scss/parts/adminlte.light.scss @@ -0,0 +1,16 @@ +/*! + * AdminLTE v3.1.0 + * Without Dark mode + * Author: Colorlib + * Website: AdminLTE.io + * License: Open source - MIT + */ + +// DISABLE DARK MODE +$enable-dark-mode: false !default; // stylelint-disable-line + +// AdminLTE Original file +// --------------------------------------------------- +@import "../adminlte"; + +// From 4e42fffb3281b4b9005509be3dc6e6144fe1e140 Mon Sep 17 00:00:00 2001 From: Daniel <50356015+danny007in@users.noreply.github.com> Date: Thu, 15 Apr 2021 17:53:23 +0530 Subject: [PATCH 2/5] fix: space in dark-mode in _accent.scss --- build/scss/mixins/_accent.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/scss/mixins/_accent.scss b/build/scss/mixins/_accent.scss index af53f7f68..af0c8ea01 100644 --- a/build/scss/mixins/_accent.scss +++ b/build/scss/mixins/_accent.scss @@ -92,7 +92,7 @@ } } @include dark-mode () { - .accent-#{$name} { + &.accent-#{$name} { .page-item { .page-link { &:hover, From 94e6ddacba4cdbfcdc9411ae8a8181e53aef37aa Mon Sep 17 00:00:00 2001 From: Daniel <50356015+danny007in@users.noreply.github.com> Date: Thu, 15 Apr 2021 17:53:29 +0530 Subject: [PATCH 3/5] Update .bundlewatch.config.json --- .bundlewatch.config.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index 0fd2339b3..4dcd3e740 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -32,6 +32,14 @@ "path": "./dist/css/alt/adminlte.extra-components.min.css", "maxSize": "4.5 kB" }, + { + "path": "./dist/css/alt/adminlte.light.css", + "maxSize": "87.7 kB" + }, + { + "path": "./dist/css/alt/adminlte.light.min.css", + "maxSize": "83.3 kB" + }, { "path": "./dist/css/alt/adminlte.pages.css", "maxSize": "3.5 kB" From 4fcf5cec21566dabe4128eb96152607323c1ed18 Mon Sep 17 00:00:00 2001 From: Daniel <50356015+danny007in@users.noreply.github.com> Date: Thu, 15 Apr 2021 18:05:02 +0530 Subject: [PATCH 4/5] Update .bundlewatch.config.json --- .bundlewatch.config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bundlewatch.config.json b/.bundlewatch.config.json index 4dcd3e740..7ba790125 100644 --- a/.bundlewatch.config.json +++ b/.bundlewatch.config.json @@ -34,11 +34,11 @@ }, { "path": "./dist/css/alt/adminlte.light.css", - "maxSize": "87.7 kB" + "maxSize": "94 kB" }, { "path": "./dist/css/alt/adminlte.light.min.css", - "maxSize": "83.3 kB" + "maxSize": "89 kB" }, { "path": "./dist/css/alt/adminlte.pages.css", From fecc46fd489ce088b4d9a467e4f14a99f315f93b Mon Sep 17 00:00:00 2001 From: Daniel <50356015+danny007in@users.noreply.github.com> Date: Thu, 15 Apr 2021 18:42:26 +0530 Subject: [PATCH 5/5] Fix: for scss/plugin --- build/scss/plugins/_bootstrap-slider.scss | 2 +- build/scss/plugins/_bootstrap-switch.scss | 2 +- build/scss/plugins/_icheck-bootstrap.scss | 2 +- build/scss/plugins/_miscellaneous.scss | 2 +- build/scss/plugins/_select2.scss | 2 +- build/scss/plugins/_sweetalert2.scss | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/scss/plugins/_bootstrap-slider.scss b/build/scss/plugins/_bootstrap-slider.scss index 85395a003..9e4c1687c 100644 --- a/build/scss/plugins/_bootstrap-slider.scss +++ b/build/scss/plugins/_bootstrap-slider.scss @@ -34,7 +34,7 @@ } } -.dark-mode { +@include dark-mode () { .slider-track { background-color: lighten($dark, 10%); background-image: none; diff --git a/build/scss/plugins/_bootstrap-switch.scss b/build/scss/plugins/_bootstrap-switch.scss index f1f41a3f3..6339e594b 100644 --- a/build/scss/plugins/_bootstrap-switch.scss +++ b/build/scss/plugins/_bootstrap-switch.scss @@ -174,7 +174,7 @@ $bootstrap-switch-handle-border-radius: .1rem; } } -.dark-mode { +@include dark-mode () { .bootstrap-switch { border-color: $gray-600; diff --git a/build/scss/plugins/_icheck-bootstrap.scss b/build/scss/plugins/_icheck-bootstrap.scss index 020f9e0e5..0bb4ea6e7 100644 --- a/build/scss/plugins/_icheck-bootstrap.scss +++ b/build/scss/plugins/_icheck-bootstrap.scss @@ -40,7 +40,7 @@ } } -.dark-mode { +@include dark-mode () { [class*="icheck-"] > input:first-child:not(:checked) { + input[type="hidden"] + label::before, + label::before { diff --git a/build/scss/plugins/_miscellaneous.scss b/build/scss/plugins/_miscellaneous.scss index e7398567f..055ac9db6 100644 --- a/build/scss/plugins/_miscellaneous.scss +++ b/build/scss/plugins/_miscellaneous.scss @@ -39,7 +39,7 @@ } -.dark-mode { +@include dark-mode () { .irs--flat .irs-line { background-color: lighten($dark, 10%); } diff --git a/build/scss/plugins/_select2.scss b/build/scss/plugins/_select2.scss index 8aef3aca7..6bb635943 100644 --- a/build/scss/plugins/_select2.scss +++ b/build/scss/plugins/_select2.scss @@ -273,7 +273,7 @@ select.form-control-sm ~ { @include select2-variant($name, $color); } -.dark-mode { +@include dark-mode () { .select2-selection { background-color: $dark; border-color: $gray-600; diff --git a/build/scss/plugins/_sweetalert2.scss b/build/scss/plugins/_sweetalert2.scss index 5743469f8..73ee57ba2 100644 --- a/build/scss/plugins/_sweetalert2.scss +++ b/build/scss/plugins/_sweetalert2.scss @@ -38,7 +38,7 @@ } } -.dark-mode { +@include dark-mode () { .swal2-popup { background-color: $dark; color: $gray-200;