Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improves the accessibility of Bootstrap 5 for Windows users using High Contrast themes

License

NotificationsYou must be signed in to change notification settings

coliff/bootstrap-forced-colors-css

Bootstrap 5 Forced Colors CSS

Bootstrap Forced Colors CSS

LICENSE: MITGitHub stars imagenpm Versionnpm Downloadsjsdelivr

Enhances the accessibility of Bootstrap 5 when using withContrast themes in Windows.

This CSS file fixes many issues and adds enhancements to make Bootstrap 5 more accessible in Firefox, Chrome, Edge on Windows using theforced-colors: active media query.

Quick start

  • Download thelatest release
  • Clone the repositorygit clone https://github.com/coliff/bootstrap-forced-colors-css.git
  • Install withnpmnpm install bootstrap-forced-colors-css
  • Install withYarnyarn add bootstrap-forced-colors-css
  • Install withComposercomposer require coliff/bootstrap-forced-colors-css

Usage

Add this in the<head> which will load the CSS using a media query as follow:

<linkrel="stylesheet"href="/css/bootstrap-forced-colors.min.css"media="screen and (forced-colors: active)">

The CSS can be loaded via a CDN:

<linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/bootstrap-forced-colors-css@1.0.7/css/bootstrap-forced-colors.min.css"media="screen and (forced-colors: active)">

Or you can import the CSS into your own CSS file:

@importbootstrap-forced-colors.min.css

Note

bootstrap-forced-colors-css improves the accessibility of Bootstrap 5 for Windows users in forced colors mode, but you should still test your site to ensure it meets your accessibility requirements.

FAQS

What does this fix/improve?

  • Accordion buttons have improved contrast in dark mode
  • Badges within buttons have a 1px border to improve contrast
  • Buttons have improved focus state contrast (2px visible outline rather than 1px)
  • Disabled buttons display the correct color using theGrayText name
  • Carousel indicators have background-color issue resolved
  • Close button has improved contrast by reducing the opacity
  • Dropdown toggle arrows appear correctly (as triangles and not rectangles)
  • List Group disabled items display the correct color using theGrayText name
  • Modal backdrop opacity changed from 0.5 to 0.8
  • Navbar Menu (hamburger) toggle icons display correctly
  • Navs Improves active and focus state contrast
  • Pagination: Active page link has outline to indicate active page
  • Pagination: Disabled page link display the correct color using theGrayText name
  • Placeholder: Fix for invisible placeholder boxes
  • Popovers: Fixes invisible arrow issue
  • Progress: Is no longer invisible
  • Progress: Improved stacked progress bar contrast
  • Spinners: Fixes animation
  • Tables: Have a 1px outline to improve contrast
  • Toasts: Fixes invisible close/dismiss button
  • Tooltips: Fix for arrows appearing as rectangles
  • Tooltips: Add 1px border to tooltips content
  • Vertical Rule: Fixes invisible vertical rule
  • Horizontal Rule: Improves contrast by changing opacity from 0.25 to 0.5

Known Issues

Demo

See this in action at:https://coliff.github.io/bootstrap-forced-colors-css/tests/

Testing

Currently, only Windows 10 & 11 with Edge, Firefox, and Chrome support forced colors mode. To test, you can enable forced colors mode in:

  • Windows 10: Go toSettings > Ease of Access > High contrast and select a theme.
  • Windows 11: Go toSettings > Accessibility > Contrast themes and select a theme.

You can also use theForced Colors Mode Emulation in Edge and Chrome on all platforms.

Note

By default, the Forced Colors Mode emulation is a dark mode theme, but you can switch to a light theme by forcing theprefers-color-scheme to light in the Dev Tools. Remember that the user can't use Bootstrap's light/dark mode theme toggle. The color scheme is set by the user at the OS level.

Note thatCanIUse lists Safari as supporting forced colors mode, however macOS itself doesn't have a Forced Colors / High Contrast mode which means it's not possible to use this with Safari at all.

About

Improves the accessibility of Bootstrap 5 for Windows users using High Contrast themes

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp