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

Remove duplicate $alert-*-scale Sass vars #38674

Merged
merged 1 commit into from
May 31, 2023

Conversation

julien-deramond
Copy link
Member

@julien-deramond julien-deramond commented May 30, 2023

Description

This PR removes duplicate $alert-bg-scale, $alert-border-scale and $alert-color-scale definitions in _variables.scss.

Motivation & Context

Even if it will be removed in v6, let's avoid duplication right now.

Type of changes

  • Refactoring (non-breaking change)

Checklist

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

Live previews

Related issues

Closes #38672

@julien-deramond julien-deramond marked this pull request as ready for review May 30, 2023 14:35
@julien-deramond julien-deramond requested a review from a team as a code owner May 30, 2023 14:35
Copy link
Member

@louismaximepiton louismaximepiton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, good catch!

@XhmikosR XhmikosR merged commit 9cc85fd into main May 31, 2023
@XhmikosR XhmikosR deleted the main-jd-remove-duplicated-sass-variables branch May 31, 2023 04:37
romankupchak93 pushed a commit to romankupchak93/bootstrap that referenced this pull request Jan 5, 2024
@kreintjes
Copy link

Is it possible these variables already stopped working in Bootstrap 5.3.0?
We used these variables to make the background and border for alert a bit lighter so they are a bit more subtle and the text is better readable (higher contrast). But since Bootstrap 5.3.0 this no longer works. Any value we set seems to be ignored.

Is there a recommended alternative for this?

@julien-deramond
Copy link
Member Author

Hi @kreintjes

Please note for your next questions that the GitHub Discussions > Q&A is more appropriate. Having questions in already merged PRs or closed issues is difficult to track for us :)

Back to your question, $alert-bg-scale, $alert-border-scale, and $alert-color-scale have been deprecated in v5.3.0 with the apparition of the dark mode (they don't do anything from v5.3.0) and will be removed entirely in v6.

Before we did the following:

@each $state, $value in $theme-colors {
  $alert-background: shift-color($value, $alert-bg-scale);
  $alert-border: shift-color($value, $alert-border-scale);
  $alert-color: shift-color($value, $alert-color-scale);
  /* etc. */
}

The dark mode doesn't permit keeping this solution so it's now defined as

@each $state in map-keys($theme-colors) {
.alert-#{$state} {
--#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis);
--#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle);
--#{$prefix}alert-border-color: var(--#{$prefix}#{$state}-border-subtle);
--#{$prefix}alert-link-color: var(--#{$prefix}#{$state}-text-emphasis);
}
}

If you'd like to keep the previous system, you'll need to override the rules in your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Duplicate $alert Sass variables
4 participants