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

Define $component-active-color with color-contrast() #39881

Open
3 tasks done
justin-oh opened this issue Apr 8, 2024 · 1 comment
Open
3 tasks done

Define $component-active-color with color-contrast() #39881

justin-oh opened this issue Apr 8, 2024 · 1 comment

Comments

@justin-oh
Copy link

Prerequisites

Describe the issue

I'm unsure if this is a bug or intended, but the variable $component-active-color is not guaranteed to contrast with $component-active-bg.

These variables are defined as follows:

$component-active-color:      $white !default;
$component-active-bg:         $primary !default;

If $primary is set to a light colour (yellow, teal, cyan, etc.) then it will be difficult to read the white text of an active component against those light backgrounds.

The solution is to set up the variables as follows:

$component-active-bg:         $primary !default;
$component-active-color:      color-contrast($component-active-bg) !default;

Reduced test cases

There is nothing to test. The definition of these variables can be seen in the code and the results should be obvious.

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of Bootstrap are you using?

5.3.3 (but it also exists on main and possibly older versions)

@julien-deramond julien-deramond changed the title Provide a general summary of the issue Define $component-active-color with color-contrast() Apr 9, 2024
@julien-deramond
Copy link
Member

Thanks for this enhancement idea @justin-oh
With the current implementation mixing CSS variables and Sass variables, it's maybe something we can do to ensure some automatism. Defining $primary with a CSS variable is not possible already, so it wouldn't break anything here, especially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To analyze
Development

No branches or pull requests

2 participants