Giter Site home page Giter Site logo

Comments (3)

carolinan avatar carolinan commented on July 17, 2024

We can adjust this function if we can decide at what luminance we need to change the link focus colors to black background and white text.

None of the light palette colors live up to the 3:1 or 4.5:1 contrast requirements when we measure the contrast between the color and the white link background.

	public function body_class( $classes ) {
		$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
		if ( 127 > self::get_relative_luminance_from_hex( $background_color ) ) {
			$classes[] = 'is-dark-theme';
		} else {
			$classes[] = 'is-light-theme';
		}

		if ( 'ffffff' === strtolower( $background_color ) ) {
			$classes[] = 'has-background-white';
		}

		return $classes;
	}

-I don't believe the is-light-theme class is used in the Customizer. It is a utility class and it is currently not used anywhere in the theme by default.

from twentytwentyone.

carolinan avatar carolinan commented on July 17, 2024

The contrast ratio between the background colors for the default and the focused state needs to be 3:1.

4.5:1 for the background and text color.

from twentytwentyone.

carolinan avatar carolinan commented on July 17, 2024

Yellow:
Foreground:#FFFFFF
Background:#EEEADD

The contrast ratio is: 1,2:1

Orange:
Foreground:#FFFFFF
Background:#E4DAD1

The contrast ratio is: 1,4:1

Red:
Foreground:#FFFFFF
Background:#E4D1D1

The contrast ratio is: 1,5:1

Purple:
Foreground:#FFFFFF
Background:#D1D1E4

The contrast ratio is: 1,5:1

Blue:
Foreground:#FFFFFF
Background:#D1DFE4

The contrast ratio is: 1,4:1

Green:
Foreground:#FFFFFF
Background:#D1E4DD

The contrast ratio is: 1,3:1

For these palette colors, a white background on focus is not enough, there would also need to be a text decoration change.
For links that have underlines, we can remove that underline on focus.

from twentytwentyone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.