Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
Improves the accessibility of Bootstrap 5 for Windows users using High Contrast themes
License
coliff/bootstrap-forced-colors-css
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
- Download thelatest release
- Clone the repository
git clone https://github.com/coliff/bootstrap-forced-colors-css.git
- Install withnpm
npm install bootstrap-forced-colors-css
- Install withYarn
yarn add bootstrap-forced-colors-css
- Install withComposer
composer require coliff/bootstrap-forced-colors-css
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.
- 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 the
GrayText
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 the
GrayText
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 the
GrayText
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
- Check theopen issues at GitHub.
See this in action at:https://coliff.github.io/bootstrap-forced-colors-css/tests/
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 to
Settings > Ease of Access > High contrast
and select a theme. - Windows 11: Go to
Settings > 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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.