npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bootstrap-forced-colors-css

v1.0.7

Published

Bootstrap 5 Forced Colors CSS for Windows High Contrast Themes

Downloads

396

Readme

LICENSE GitHub stars image npm Version jsdelivr npm Downloads

Enhances the accessibility of Bootstrap 5 when using with Contrast 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 the forced-colors: active media query.

Quick start

  • Download the latest release
  • Clone the repository git clone https://github.com/coliff/bootstrap-forced-colors-css.git
  • Install with npm npm install bootstrap-forced-colors-css
  • Install with Yarn yarn add bootstrap-forced-colors-css
  • Install with Composer composer require coliff/bootstrap-forced-colors-css

Usage

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

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

The CSS can be loaded via a CDN:

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/[email protected]/css/bootstrap-forced-colors.min.css"
  media="screen and (forced-colors: active)">

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

@import bootstrap-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 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

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 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 the Forced 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 the prefers-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 that CanIUse 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.