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 mode: form color #2278

Merged
merged 7 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scss/_root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
--#{$prefix}hover-color: #{$body-color};
--#{$prefix}active-bg: #{$gray-400};
--#{$prefix}disabled-color: #{$gray-500};
--#{$prefix}disabled-filter: #{$disabled-filter};
--#{$prefix}placeholder-color: #{$gray-700};
// ******* End additions for dark-mode
}
Expand Down Expand Up @@ -217,6 +218,7 @@
--#{$prefix}hover-color: #{$brand-orange};
--#{$prefix}active-bg: #{$gray-700};
--#{$prefix}disabled-color: #{$gray-700};
--#{$prefix}disabled-filter: #{$disabled-filter-dark};
--#{$prefix}placeholder-color: #{$gray-600};
// ******* End additions for dark-mode
// scss-docs-end root-dark-mode-vars
Expand Down
2 changes: 2 additions & 0 deletions scss/_variables-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ $code-color-dark: tint-color($code-color, 40%) !default;
$mark-color-dark: $black !default; // Boosted mod: instead of `$body-color-dark`
$mark-bg-dark: $white !default; // Boosted mod: instead of `$yellow-800`

$disabled-filter-dark: brightness(0) invert(1) brightness(.4) !default; // Boosted mod

$focus-visible-inner-color-dark: $black !default; // Boosted mod
$focus-visible-outer-color-dark: $white !default; // Boosted mod

Expand Down
9 changes: 7 additions & 2 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ $svg-as-custom-props: (
// see https://codepen.io/sosuke/pen/Pjoqqp
$invert-filter: invert(1) !default;
$orange-filter: invert(46%) sepia(60%) saturate(2878%) hue-rotate(6deg) brightness(98%) contrast(104%) !default;

$disabled-filter: brightness(0) invert(1) brightness(.8) !default;
// End mod

// Options
Expand Down Expand Up @@ -1132,8 +1134,11 @@ $input-line-height-lg: $h5-line-height !default; // Boosted mod
$input-transition: border-color $transition-duration $transition-timing, $transition-focus !default;

$form-color-width: 2.5rem !default; // Boosted mod: instead of `3rem`
$form-color-disabled-border-color: $gray-500 !default; // Boosted mod
$form-color-disabled-background-swatch: brightness(0) invert(1) brightness(.8) !default; // Boosted mod
$form-color-border-color: var(--#{$prefix}emphasis-color) !default; // Boosted mod
$form-color-hover-bg-color: var(--#{$prefix}emphasis-color) !default; // Boosted mod
$form-color-disabled-bg-color: $input-bg !default; // Boosted mod
$form-color-disabled-border-color: var(--#{$prefix}disabled-color) !default; // Boosted mod
$form-color-disabled-background-swatch: var(--#{$prefix}disabled-filter) !default; // Boosted mod
// scss-docs-end form-input-variables

// scss-docs-start form-check-variables
Expand Down
6 changes: 3 additions & 3 deletions scss/forms/_form-control.scss
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ textarea {
width: $form-color-width;
height: $input-height;
padding: $input-padding-y;
border-color: var(--#{$prefix}body-color); // Boosted mod
border-color: $form-color-border-color; // Boosted mod

// Boosted mod
&:hover {
background-color: var(--#{$prefix}body-color);
background-color: $form-color-hover-bg-color;
}

&:disabled {
background-color: var(--#{$prefix}body-bg);
background-color: $form-color-disabled-bg-color;
border-color: $form-color-disabled-border-color;

&::-moz-color-swatch {
Expand Down
52 changes: 42 additions & 10 deletions site/content/docs/5.3/dark-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,43 @@ Additional variables for dark-mode (temporary)

## Forms

### Color

<h4 class="mt-3">No theme</h4>

<div class="border border-tertiary p-3">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" disabled>
</div>

<h4 class="mt-3">Dark theme on container</h4>

<div class="border border-tertiary p-3 bg-body" data-bs-theme="dark">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" disabled>
</div>

<h4 class="mt-3">Light theme on container</h4>

<div class="border border-tertiary p-3 bg-body" data-bs-theme="light">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" disabled>
</div>

<h4 class="mt-3">Dark theme on component</h4>

<div class="border border-tertiary p-3" style="background-color: #282d55;">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" data-bs-theme="dark">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" data-bs-theme="dark" disabled>
</div>

<h4 class="mt-3">Light theme on component</h4>

<div class="border border-tertiary p-3" style="background-color: #b5e8f7">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" data-bs-theme="light">
<input type="color" class="form-control form-control-color" value="#a885d8" title="Choose your color" data-bs-theme="light" disabled>
</div>

### Controls

<h4 class="mt-3">No theme</h4>
Expand All @@ -657,8 +694,6 @@ Additional variables for dark-mode (temporary)
<textarea class="form-control" rows="2" disabled>Disabled textarea placeholder</textarea>
<input type="text" class="form-control" value="Readonly input value" readonly>
<textarea class="form-control" rows="2" placeholder="Readonly textarea placeholder" readonly></textarea>
<input type="text" class="form-control" placeholder="Readonly disabled input placeholder" readonly disabled>
<textarea class="form-control" rows="2" readonly disabled>Readonly disabled textarea value</textarea>
<input type="text" class="form-control-plaintext" value="Readonly plaintext input" readonly>
</div>

Expand All @@ -671,8 +706,6 @@ Additional variables for dark-mode (temporary)
<textarea class="form-control" rows="2" disabled>Disabled textarea placeholder</textarea>
<input type="text" class="form-control" value="Readonly input value" readonly>
<textarea class="form-control" rows="2" placeholder="Readonly textarea placeholder" readonly></textarea>
<input type="text" class="form-control" placeholder="Readonly disabled input placeholder" readonly disabled>
<textarea class="form-control" rows="2" readonly disabled>Readonly disabled textarea value</textarea>
<input type="text" class="form-control-plaintext" value="Readonly plaintext input" readonly>
</div>

Expand All @@ -685,8 +718,6 @@ Additional variables for dark-mode (temporary)
<textarea class="form-control" rows="2" disabled>Disabled textarea placeholder</textarea>
<input type="text" class="form-control" value="Readonly input value" readonly>
<textarea class="form-control" rows="2" placeholder="Readonly textarea placeholder" readonly></textarea>
<input type="text" class="form-control" placeholder="Readonly disabled input placeholder" readonly disabled>
<textarea class="form-control" rows="2" readonly disabled>Readonly disabled textarea value</textarea>
<input type="text" class="form-control-plaintext" value="Readonly plaintext input" readonly>
</div>

Expand All @@ -699,8 +730,6 @@ Additional variables for dark-mode (temporary)
<textarea class="form-control" rows="2" data-bs-theme="dark" disabled>Disabled textarea placeholder</textarea>
<input type="text" class="form-control" value="Readonly input value" data-bs-theme="dark" readonly>
<textarea class="form-control" rows="2" placeholder="Readonly textarea placeholder" data-bs-theme="dark" readonly></textarea>
<input type="text" class="form-control" placeholder="Readonly disabled input placeholder" data-bs-theme="dark" readonly disabled>
<textarea class="form-control" rows="2" data-bs-theme="dark" readonly disabled>Readonly disabled textarea value</textarea>
<input type="text" class="form-control-plaintext" value="Readonly plaintext input" data-bs-theme="dark" readonly>
</div>

Expand All @@ -713,8 +742,6 @@ Additional variables for dark-mode (temporary)
<textarea class="form-control" rows="2" data-bs-theme="light" disabled>Disabled textarea placeholder</textarea>
<input type="text" class="form-control" value="Readonly input value" data-bs-theme="light" readonly>
<textarea class="form-control" rows="2" placeholder="Readonly textarea placeholder" data-bs-theme="light" readonly></textarea>
<input type="text" class="form-control" placeholder="Readonly disabled input placeholder" data-bs-theme="light" readonly disabled>
<textarea class="form-control" rows="2" data-bs-theme="light" readonly disabled>Readonly disabled textarea value</textarea>
<input type="text" class="form-control-plaintext" value="Readonly plaintext input" data-bs-theme="light" readonly>
</div>

Expand All @@ -724,30 +751,35 @@ Additional variables for dark-mode (temporary)

<div class="border border-tertiary p-3">
<input type="range" class="form-range">
<input type="range" class="form-range" disabled>
</div>

<h4 class="mt-3">Dark theme on container</h4>

<div class="border border-tertiary p-3 bg-body" data-bs-theme="dark">
<input type="range" class="form-range">
<input type="range" class="form-range" disabled>
</div>

<h4 class="mt-3">Light theme on container</h4>

<div class="border border-tertiary p-3 bg-body" data-bs-theme="light">
<input type="range" class="form-range">
<input type="range" class="form-range" disabled>
</div>

<h4 class="mt-3">Dark theme on component</h4>

<div class="border border-tertiary p-3" style="background-color: #282d55;">
<input type="range" class="form-range" data-bs-theme="dark">
<input type="range" class="form-range" data-bs-theme="dark" disabled>
</div>

<h4 class="mt-3">Light theme on component</h4>

<div class="border border-tertiary p-3" style="background-color: #b5e8f7">
<input type="range" class="form-range" data-bs-theme="light">
<input type="range" class="form-range" data-bs-theme="light" disabled>
</div>

### Star rating
Expand Down