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

Fade disabled buttons into luminance-gray color of current plane background #40559

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rr-it
Copy link

@rr-it rr-it commented Jun 15, 2024

Description

Fade disabled buttons into luminance-gray color of current plane background.

Disabled buttons color is mixed with a gray having the identical luminance as the background-color. This results in the following color change of disabled buttons.

Before New
Bootstrap CSS @5.3.3
https://codepen.io/rr-it/pen/LYoOKrx
Bootstrap CSS @deploy-preview-40559
https://codepen.io/rr-it/pen/jOoYVMm
bootstrap-disabled-buttons-before bootstrap-disabled-buttons-after

Lightness:

Lightened on light background and darkened on dark background.

In comparison:
Identical behaviour as before. Buttons lightness is slightly (fade-percentage) fading into the background.

Saturation:

Slightly desaturated.

In comparison:
On black/white gray background: Identical behaviour as before.
On colorful background: Before there was an unintentional mix between bg-color and button-color saturation. Now the button is simply slightly (fade-percentage) desaturated.

Hue:

Stays identical.

In comparison:
On black/white gray background: Identical behaviour as before.
On colorful background: Before there was an unintentional  cross-fading between bg-color and button-color resulting in unfortunate dyeing of the  button. Now the button keeps its color hue.

Introduction of new css-var --bs-current-plane-bg

This introduces the css-var --bs-current-plane-bg to hold a reference to the bg-color of the current plane.

Motivation: inherit is currently not usable inside CSS functions. See w3c/csswg-drafts#9757

This css-var is set in

  • body-tag
  • .bg-<COLOR> classes
  • elements which serve as plane and set their own background-color

This css-var should also be set for custom elements that set their own background-color.

body {
  --bs-current-plane-bg: var(--bs-body-bg);
}

.bg-primary {
  --bs-current-plane-bg: var(--bs-primary);
}

.bg-secondary {
  --bs-current-plane-bg: var(--bs-secondary);
}

.bg-success {
  --bs-current-plane-bg: var(--bs-success);
}

[…]

Motivation & Context

Before disabled buttons simply used opacity and color-cross-fading happened.
E.g. a disabled red button on a blue plane became purple.

More real world example:

Gray disabled button in a button-group on selected row with blue background:
grafik

This 'disabled' button has a blueish look and thereby looks somehow activated.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

Resolves #40557

…lor via `var()`-name in `.bg-<COLOR>` classes

```css
body {
  --bs-current-plane-bg: var(--bs-body-bg);
}

.bg-primary {
  --bs-current-plane-bg: var(--bs-primary);
}

.bg-secondary {
  --bs-current-plane-bg: var(--bs-secondary);
}

.bg-success {
  --bs-current-plane-bg: var(--bs-success);
}

[…]
```
@rr-it rr-it requested a review from a team as a code owner June 15, 2024 16:11
…ground

### Before:

Disabled buttons simply used `opacity` and color-cross-fading happened.
E.g. a disabled red button on a blue plane became purple.

### With this change:

Disabled buttons color is mixed with a gray having the identical luminance as the background-color. This results in the following color change of disabled buttons.

#### Lightness:

Lightened on light background and darkened on dark background.

In comparison:
Identical behaviour as before. Buttons lightness is slightly (`fade-percentage`) fading into the background.

#### Saturation:

Slightly desaturated.

In comparison:
On black/white gray background: Identical behaviour as before.
On colorful background: Before there was an unintentional mix between bg-color and button-color saturation. Now the button is simply slightly (`fade-percentage`) desaturated.

#### Hue
Stays identical.

In comparison:
On black/white gray background: Identical behaviour as before.
On colorful background: Before there was an unintentional  cross-fading between bg-color and button-color resulting in unfortunate dyeing of the  button. Now the button keeps its color hue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabled buttons get colored on colorful background
2 participants