wc_light_or_dark( mixed $color, string $dark = '#000000', string $light = '#FFFFFF' )

Detect if we should use a light or dark color on a background color.


Description Description


Parameters Parameters

$color

(Required) Color.

$dark

(Optional) Darkest reference. Defaults to '#000000'.

Default value: '#000000'

$light

(Optional) Lightest reference. Defaults to '#FFFFFF'.

Default value: '#FFFFFF'


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-formatting-functions.php

	function wc_light_or_dark( $color, $dark = '#000000', $light = '#FFFFFF' ) {
		return wc_hex_is_light( $color ) ? $dark : $light;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.