Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark theme clean up #2942

Merged
merged 10 commits into from Mar 21, 2020
180 changes: 103 additions & 77 deletions scss/_base_forms-tick-elements.scss
Expand Up @@ -94,7 +94,6 @@ $box-offsets-top: (
&.is-table-header::before {
top: #{$sp-unit * map-get($box-offsets-top, table-header) - $box-size};
}

}

@media (min-width: $breakpoint-heading-threshold) {
Expand Down Expand Up @@ -376,7 +375,6 @@ $box-offsets-top: (
&.is-table-header::after {
top: #{$circle-offset-top + $sp-unit * map-get($box-offsets-top, table-header) - $box-size};
}

}

@media (min-width: $breakpoint-heading-threshold) {
Expand Down Expand Up @@ -436,104 +434,132 @@ $box-offsets-top: (
}

// Theming
// common properties
%vf-tick-elements--light-theme {
& + label {
color: $colors--light-theme--text-default;

&::before {
background: $colors--light-theme--background;
border: 1px solid $colors--light-theme--border-high-contrast;
}
}
}

%vf-tick-elements--dark-theme {
& + label {
color: $colors--dark-theme--text-default;

&::before {
background: $colors--dark-theme--background;
border: 1px solid $colors--dark-theme--border-high-contrast;
}
}
}

// checkbox specific properties
%vf-checkbox--light-theme {
& + label {
&::after {
color: $colors--light-theme--background;
}
}
}

%vf-checkbox--dark-theme {
& + label {
&::after {
color: $colors--dark-theme--text-default;
}
}
}

// radio specific properties
%vf-radio--light-theme {
& + label {
&::after {
background-color: $colors--light-theme--background;
}
}
}

%vf-radio--dark-theme {
& + label {
&::after {
background-color: $color-x-light;
}
}
}

@if ($theme-default-forms == 'dark') {
[type='checkbox'] {
@extend %vf-tick-elements--dark-theme;
@extend %vf-checkbox--dark-theme;
@include vf-checkbox-dark-theme;
}

[type='radio'] {
@extend %vf-tick-elements--dark-theme;
@extend %vf-radio--dark-theme;
@include vf-radio-dark-theme;
}

// sass-lint:disable no-qualifying-elements
[type='checkbox'].is-light {
@extend %vf-tick-elements--light-theme;
@extend %vf-checkbox--light-theme;
@include vf-checkbox-light-theme;
}

[type='radio'].is-light {
@extend %vf-tick-elements--light-theme;
@extend %vf-radio--light-theme;
@include vf-radio-light-theme;
}
} @else {
[type='checkbox'] {
@extend %vf-tick-elements--light-theme;
@extend %vf-checkbox--light-theme;
@include vf-checkbox-light-theme;
}

[type='radio'] {
@extend %vf-tick-elements--light-theme;
@extend %vf-radio--light-theme;
@include vf-radio-light-theme;
}

// sass-lint:disable no-qualifying-elements
[type='checkbox'].is-dark {
@extend %vf-tick-elements--dark-theme;
@extend %vf-checkbox--dark-theme;
@include vf-checkbox-dark-theme;
}

[type='radio'].is-dark {
@extend %vf-tick-elements--dark-theme;
@extend %vf-radio--dark-theme;
@include vf-radio-dark-theme;
}
}
}

// theme for common properties on radios and checkboxes
@mixin vf-tick-elements-theme(
// color of the tick element label text
$color-tick-text,
// color of the tick element background
$color-tick-background,
// color of the tick element border
$color-tick-border
) {
& + label {
color: $color-tick-text;

&::before {
background: $color-tick-background;
border: 1px solid $color-tick-border;
}
}
}

// theme for checkbox (including common properties)
@mixin vf-checkbox-theme(
// color of the tick element label text
$color-tick-text,
// color of the tick element background
$color-tick-background,
// color of the tick element border
$color-tick-border,
// color of the checkbox tick
$color-checkbox-tick
) {
@include vf-tick-elements-theme($color-tick-text, $color-tick-background, $color-tick-border);

& + label {
&::after {
color: $color-checkbox-tick;
}
}
}

@mixin vf-checkbox-light-theme {
@include vf-checkbox-theme(
$color-tick-text: $colors--light-theme--text-default,
$color-tick-background: $colors--light-theme--background,
$color-tick-border: $colors--light-theme--border-high-contrast,
$color-checkbox-tick: $colors--light-theme--background
);
}

@mixin vf-checkbox-dark-theme {
@include vf-checkbox-theme(
$color-tick-text: $colors--dark-theme--text-default,
$color-tick-background: $colors--dark-theme--background,
$color-tick-border: $colors--dark-theme--border-high-contrast,
$color-checkbox-tick: $colors--dark-theme--text-default
);
}

// theme for radio (including common properties)
@mixin vf-radio-theme(
// color of the tick element label text
$color-tick-text,
// color of the tick element background
$color-tick-background,
// color of the tick element border
$color-tick-border,
// color of the radio dot
$color-radio-dot
) {
@include vf-tick-elements-theme($color-tick-text, $color-tick-background, $color-tick-border);

& + label {
&::after {
background-color: $color-radio-dot;
}
}
}

@mixin vf-radio-light-theme {
@include vf-radio-theme(
$color-tick-text: $colors--light-theme--text-default,
$color-tick-background: $colors--light-theme--background,
$color-tick-border: $colors--light-theme--border-high-contrast,
$color-radio-dot: $colors--light-theme--background
);
}

@mixin vf-radio-dark-theme {
@include vf-radio-theme(
$color-tick-text: $colors--dark-theme--text-default,
$color-tick-background: $colors--dark-theme--background,
$color-tick-border: $colors--dark-theme--border-high-contrast,
$color-radio-dot: $colors--dark-theme--text-default
);
}
56 changes: 18 additions & 38 deletions scss/_base_hr.scss
Expand Up @@ -18,56 +18,36 @@
// Theming
@if ($theme-default-hr == 'dark') {
hr {
@extend %hr--dark-theme;
@include vf-hr-dark-theme;
}

// sass-lint:disable no-qualifying-elements
// sass-lint:disable-block no-qualifying-elements
hr.is-light {
@extend %hr--light-theme;
@include vf-hr-light-theme;
}
} @else {
hr {
@extend %hr--light-theme;
@include vf-hr-light-theme;
}

// sass-lint:disable no-qualifying-elements
// sass-lint:disable-block no-qualifying-elements
hr.is-dark {
@extend %hr--dark-theme;
@include vf-hr-dark-theme;
}
}
}

%hr--dark-theme {
background: $colors--dark-theme--border-default;
}

%hr--light-theme {
background: $colors--light-theme--border-default;
}

.row.is-bordered {
position: relative;

&::before {
background: $color-mid-light;
content: '';
height: 1px;
margin-bottom: calc(#{$spv-inner--scaleable} - 1px);
position: absolute;

@media (max-width: $threshold-4-6-col) {
left: map-get($grid-margin-widths, small);
right: map-get($grid-margin-widths, small);
}
@mixin vf-hr-theme(
// color of the horizontal rule line
$color-hr-line
) {
background: $color-hr-line;
}

@media (min-width: $threshold-4-6-col) and (max-width: $threshold-6-12-col) {
left: map-get($grid-margin-widths, medium);
right: map-get($grid-margin-widths, medium);
}
@mixin vf-hr-light-theme {
@include vf-hr-theme($colors--light-theme--border-default);
}

@media (min-width: $threshold-6-12-col) {
left: map-get($grid-margin-widths, large);
right: map-get($grid-margin-widths, large);
}
}
}
@mixin vf-hr-dark-theme {
@include vf-hr-theme($colors--dark-theme--border-default);
}