Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !34100

Updated utility API (css-vars utils and new bg/color utils), plus new root CSS variables

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Mark Otto requested to merge v510-dev into main May 24, 2021
  • Overview 5
  • Commits 4
  • Pipelines 0
  • Changes 12

Consider this a bit of an integration branch for now while work on v5.0.2 continues. I'm using this to consolidate efforts across a handful of PRs.


Changes

  • cda10d6: Updates .text-{color} and .bg-{color} utilities to use CSS variables.

    Both .text-{color} and .bg-{color} utilities are now powered by CSS variables. For example, we use the new --bs-primary-rgb: 13, 110, 253 and --bs-text-opacity (with no default value, but a fallback of 1) in .text-primary where the new computed style is color: rgba(13, 110, 253, 1).

    We generate these new RGB variables with some new functions that convert hex values to RGB and that generate new Sass maps based on our $theme-colors map. These new maps are now used to generate our utilities for text color and background-color and include new options for .{text|bg}-black, .{text|bg}-white, and .{text|bg}-body.

    The utility API has been updated to include a new css-var boolean option. When set to true, it generates only local CSS variables using the API's class and individual values. This is how we've added our new .text-opacity-* and .bg-opacity-* utilities. Add these new classes alonside .text-{color} and .bg-{color} utilities to set their alpha transparency on the fly.

    This also deprecates .text-black-50 and .text-white-50 since we can create those on the fly now.

    Fixes #33320 (closed). Fixes #33985 (closed).

  • c754e3e: Adds additional :root CSS variables for all our shades of gray and some $body- Sass variables.

    Previously our :root CSS variables only included our $colors and $theme-colors. Now they also include $grays. We've also added new CSS variables for common <body> styles with default values set by their Sass variable counterparts (e.g., --#{$variable-prefix}body-color: #{$body-color};).

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: v510-dev