123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579 |
- //
- // General: Mixins
- //
- // Cards Variant
- @mixin cards-variant($name, $color) {
- .card-#{$name} {
- &:not(.card-outline) {
- > .card-header {
- background-color: $color;
- border-bottom: 0;
- &,
- a {
- color: color-yiq($color);
- }
- a.active {
- color: color-yiq($white);
- }
- .nav-item {
- &:first-child .nav-link {
- margin-left: -1px;
- }
- }
- }
- }
- &.card-outline {
- border-top: 3px solid $color;
- .nav-item {
- border-bottom: 0;
- &:first-child .nav-link {
- border-left: 0;
- margin-left: 0;
- }
- }
- }
- &.card-outline-tabs {
- border-top: 0;
- > .card-header {
- .nav-item {
- &:first-child .nav-link {
- border-left: 0;
- margin-left: 0;
- }
- }
- a {
- border-top: 3px solid transparent;
- &:hover {
- border-top: 3px solid $nav-tabs-border-color;
- }
- &.active {
- &:hover {
- margin-top: 0;
- }
- border-top: 3px solid $color;
- }
- }
- }
- }
- }
- .bg-#{$name},
- .bg-gradient-#{$name},
- .card-#{$name}:not(.card-outline) {
- .btn-tool {
- color: rgba(color-yiq($color), 0.8);
- &:hover {
- color: color-yiq($color);
- }
- }
- }
- .card.bg-#{$name},
- .card.bg-gradient-#{$name} {
- .bootstrap-datetimepicker-widget {
- .table td,
- .table th {
- border: none;
- }
- table thead tr:first-child th:hover,
- table td.day:hover,
- table td.hour:hover,
- table td.minute:hover,
- table td.second:hover {
- background: darken($color, 8%);
- color: color-yiq($color);
- }
- table td.today::before {
- border-bottom-color: color-yiq($color);
- }
- table td.active,
- table td.active:hover {
- background: lighten($color, 10%);
- color: color-yiq($color);
- }
- }
- }
- }
- // Sidebar Color
- @mixin sidebar-color($color) {
- .nav-sidebar > .nav-item {
- & > .nav-link.active {
- background-color: $color;
- color: color-yiq($color);
- }
- }
- }
- // Sidebar Mini Breakpoints
- @mixin sidebar-mini-breakpoint() {
- // A fix for text overflow while transitioning from sidebar mini to full sidebar
- .nav-sidebar,
- .nav-sidebar > .nav-header,
- .nav-sidebar .nav-link {
- white-space: nowrap;
- overflow: hidden;
- }
- // When the sidebar is collapsed...
- &.sidebar-collapse {
- .d-hidden-mini {
- display: none;
- }
- // Apply the new margins to the main content and footer
- .content-wrapper,
- .main-footer,
- .main-header {
- margin-left: $sidebar-mini-width !important;
- }
- // Make the sidebar headers
- .nav-sidebar .nav-header {
- display: none;
- }
- .nav-sidebar .nav-link p {
- width: 0;
- }
- .sidebar .user-panel > .info,
- .nav-sidebar .nav-link p,
- .brand-text {
- margin-left: -10px;
- opacity: 0;
- visibility: hidden;
- }
- .logo-xl {
- opacity: 0;
- visibility: hidden;
- }
- .logo-xs {
- display: inline-block;
- opacity: 1;
- visibility: visible;
- }
- // Modify the sidebar to shrink instead of disappearing
- .main-sidebar {
- overflow-x: hidden;
- &,
- &::before {
- // Don't go away! Just shrink
- margin-left: 0;
- width: $sidebar-mini-width;
- }
- .user-panel {
- .image {
- float: none;
- }
- }
- &:hover,
- &.sidebar-focused {
- width: $sidebar-width;
- .nav-sidebar.nav-child-indent .nav-treeview {
- padding-left: 1rem;
- }
- .brand-link {
- width: $sidebar-width;
- }
- .user-panel {
- text-align: left;
- .image {
- float: left;
- }
- }
- .user-panel > .info,
- .nav-sidebar .nav-link p,
- .brand-text,
- .logo-xl {
- display: inline-block;
- margin-left: 0;
- opacity: 1;
- visibility: visible;
- }
- .nav-flat {
- .nav-icon {
- margin-left: 0;
- }
- .nav-treeview {
- .nav-icon {
- margin-left: -.2rem;
- }
- }
- }
- .logo-xs {
- opacity: 0;
- visibility: hidden;
- }
- .brand-image {
- margin-right: .5rem;
- }
- // Make the sidebar links, menus, labels, badges
- // and angle icons disappear
- .sidebar-form,
- .user-panel > .info {
- display: block !important;
- -webkit-transform: translateZ(0);
- }
- .nav-sidebar > .nav-item > .nav-link > span {
- display: inline-block !important;
- }
- }
- }
- // Make an element visible only when sidebar mini is active
- .visible-sidebar-mini {
- display: block !important;
- }
- &.layout-fixed {
- .main-sidebar:hover {
- .brand-link {
- width: $sidebar-width;
- }
- }
- .brand-link {
- width: $sidebar-mini-width;
- }
- }
- }
- }
- // Navbar Variant
- @mixin navbar-variant($color, $font-color: rgba(255, 255, 255, 0.8), $hover-color: #f6f6f6, $hover-bg: rgba(0, 0, 0, 0.1)) {
- background-color: $color;
- .nav > li > a {
- color: $font-color;
- }
- .nav > li > a:hover,
- .nav > li > a:active,
- .nav > li > a:focus,
- .nav .open > a,
- .nav .open > a:hover,
- .nav .open > a:focus,
- .nav > .active > a {
- background: $hover-bg;
- color: $hover-color;
- }
- // Add color to the sidebar toggle button
- .sidebar-toggle {
- color: $font-color;
- &:hover,
- &:focus {
- background: $hover-bg;
- color: $hover-color;
- }
- }
- }
- // Logo color Variant
- @mixin logo-variant($bg-color, $color: #fff, $border-bottom-color: transparent, $border-bottom-width: 0) {
- background-color: $bg-color;
- border-bottom: $border-bottom-width solid $border-bottom-color;
- color: $color;
- &:hover,
- &:focus {
- background-color: darken($bg-color, 1%);
- }
- }
- // Direct Chat Variant
- @mixin direct-chat-variant($bg-color, $color: #fff) {
- .right > .direct-chat-text {
- background: $bg-color;
- border-color: $bg-color;
- color: color-yiq($bg-color);
- &::after,
- &::before {
- border-left-color: $bg-color;
- }
- }
- @each $name, $color in $theme-colors {
- &.bg-#{$name},
- &.bg-gradient-#{$name} {
- .direct-chat-timestamp {
- @if (color-yiq($color) == $yiq-text-dark) {
- color: lighten(color-yiq($color), 10%);
- } @else {
- color: darken(color-yiq($color), 20%);
- }
- }
- }
- }
- @each $name, $color in $colors {
- &.bg-#{$name},
- &.bg-gradient-#{$name} {
- .direct-chat-timestamp {
- @if (color-yiq($color) == $yiq-text-dark) {
- color: lighten(color-yiq($color), 10%);
- } @else {
- color: darken(color-yiq($color), 20%);
- }
- }
- }
- }
- }
- // Background Variant
- @mixin background-variant($name, $color) {
- .bg-#{$name} {
- background-color: #{$color} !important;
- &,
- > a {
- color: color-yiq($color) !important;
- }
- &.btn {
- &:hover {
- border-color: darken($color, 10%);
- color: darken(color-yiq($color), 7.5%);
- }
- &:not(:disabled):not(.disabled):active,
- &:not(:disabled):not(.disabled).active,
- &:active,
- &.active {
- background-color: darken($color, 10%) !important;
- border-color: darken($color, 12.5%);
- color: color-yiq(darken($color, 10%));
- }
- }
- }
- }
- // Background Gradient Variant
- @mixin background-gradient-variant($name, $color) {
- .bg-gradient-#{$name} {
- @include bg-gradient-variant('&', $color);
- color: color-yiq($color);
- &.btn {
- &.disabled,
- &:disabled,
- &:not(:disabled):not(.disabled):active,
- &:not(:disabled):not(.disabled).active,
- .show > &.dropdown-toggle {
- background-image: none !important;
- }
- &:hover {
- @include bg-gradient-variant('&', darken($color, 7.5%));
- border-color: darken($color, 10%);
- color: darken(color-yiq($color), 7.5%);
- }
- &:not(:disabled):not(.disabled):active,
- &:not(:disabled):not(.disabled).active,
- &:active,
- &.active {
- @include bg-gradient-variant('&', darken($color, 10%));
- border-color: darken($color, 12.5%);
- color: color-yiq(darken($color, 10%));
- }
- }
- }
- }
- // Custom Switch Variant
- @mixin custom-switch-variant($name, $color) {
- &.custom-switch-off-#{$name} {
- & .custom-control-input ~ .custom-control-label::before {
- background: #{$color};
- border-color: darken($color, 20%);
- }
- & .custom-control-input:focus ~ .custom-control-label::before {
- box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
- }
- & .custom-control-input ~ .custom-control-label::after {
- background: darken($color, 25%);
- }
- }
- &.custom-switch-on-#{$name} {
- & .custom-control-input:checked ~ .custom-control-label::before {
- background: #{$color};
- border-color: darken($color, 20%);
- }
- & .custom-control-input:checked:focus ~ .custom-control-label::before {
- box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
- }
- & .custom-control-input:checked ~ .custom-control-label::after {
- background: lighten($color, 30%);
- }
- }
- }
- // Custom Range Variant
- @mixin custom-range-variant($name, $color) {
- &.custom-range-#{$name} {
- &:focus {
- outline: none;
- &::-webkit-slider-thumb {
- box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
- }
- &::-moz-range-thumb {
- box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
- }
- &::-ms-thumb {
- box-shadow: 0 0 0 1px $body-bg, 0 0 0 2px rgba($color, .25);
- }
- }
- &::-webkit-slider-thumb {
- background-color: $color;
- &:active {
- background-color: lighten($color, 35%);
- }
- }
- &::-moz-range-thumb {
- background-color: $color;
- &:active {
- background-color: lighten($color, 35%);
- }
- }
- &::-ms-thumb {
- background-color: $color;
- &:active {
- background-color: lighten($color, 35%);
- }
- }
- }
- }
- // Toast Variant
- @mixin toast-variant($name, $color) {
- &.bg-#{$name} {
- background: rgba($color, .9) !important;
- @if (color-yiq($color) == $yiq-text-light) {
- .close {
- color: color-yiq($color);
- text-shadow: 0 1px 0 #000;
- }
- }
- .toast-header {
- background: rgba($color, .85);
- color: color-yiq($color);
- }
- }
- }
- // Accent Variant
- @mixin accent-variant($name, $color) {
- .accent-#{$name} {
- $link-color: $color;
- $link-hover-color: darken($color, 15%);
- $pagination-active-bg: $color;
- $pagination-active-border-color: $color;
- a {
- color: $link-color;
- @include hover {
- color: $link-hover-color;
- }
- }
- .page-item {
- &.active .page-link {
- background-color: $pagination-active-bg;
- border-color: $pagination-active-border-color;
- }
- &.disabled .page-link {
- background-color: $pagination-disabled-bg;
- border-color: $pagination-disabled-border-color;
- }
- }
- }
- }
- // ETC
- @mixin translate($x, $y) {
- transform: translate($x, $y);
- }
- // Different radius each side
- @mixin border-radius-sides($top-left, $top-right, $bottom-left, $bottom-right) {
- border-radius: $top-left $top-right $bottom-left $bottom-right;
- }
- @mixin calc($property, $expression) {
- #{$property}: calc(#{$expression});
- }
- @mixin rotate($value) {
- transform: rotate($value);
- }
- @mixin animation($animation) {
- animation: $animation;
- }
- // Gradient background
- @mixin gradient($color: #F5F5F5, $start: #EEE, $stop: #FFF) {
- background: $color;
- background: -webkit-gradient(linear, left bottom, left top, color-stop(0, $start), color-stop(1, $stop));
- background: -ms-linear-gradient(bottom, $start, $stop);
- background: -moz-linear-gradient(center bottom, $start 0%, $stop 100%);
- background: -o-linear-gradient($stop, $start);
- }
|