From 1535ccde629e9c00de5770621b9713d380d0cca9 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Fri, 18 Sep 2020 14:07:20 +0300 Subject: [PATCH] Change calculated color to #000 from #222 --- assets/js/customize-preview.js | 10 +++++----- classes/class-twenty-twenty-one-custom-colors.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/js/customize-preview.js b/assets/js/customize-preview.js index 23caf3f9b..58d9248c5 100644 --- a/assets/js/customize-preview.js +++ b/assets/js/customize-preview.js @@ -2,9 +2,9 @@ /** * Get luminance from a HEX color. - * + * * @param {string} hex - The hex color. - * + * * @return {number} */ function twentytwentyoneGetHexLum( hex ) { @@ -14,9 +14,9 @@ /** * Get RGB from HEX. - * + * * @param {string} hex - The hex color. - * + * * @return {Object} - Returns an object {r, g, b} */ function twentytwentyoneGetRgbFromHex( hex ) { @@ -40,7 +40,7 @@ api( 'background_color', function( value ) { value.bind( function( to ) { var lum = twentytwentyoneGetHexLum( to ), - textColor = 127 < lum ? '#222' : '#fff'; + textColor = 127 < lum ? '#000' : '#fff'; document.documentElement.style.setProperty( '--global--color-primary', textColor ); document.documentElement.style.setProperty( '--global--color-secondary', textColor ); diff --git a/classes/class-twenty-twenty-one-custom-colors.php b/classes/class-twenty-twenty-one-custom-colors.php index 0ba07f3b0..ea49d6caf 100644 --- a/classes/class-twenty-twenty-one-custom-colors.php +++ b/classes/class-twenty-twenty-one-custom-colors.php @@ -31,7 +31,7 @@ public function __construct() { } /** - * Determine the luminance of the given color and then return #FFFFFF or #222222 so that our text is always readable. + * Determine the luminance of the given color and then return #fff or #000 so that our text is always readable. * * @access public * @@ -40,7 +40,7 @@ public function __construct() { * @return string (hex color) */ public function custom_get_readable_color( $background_color ) { - return ( 127 < $this->get_relative_luminance_from_hex( $background_color ) ) ? '#222222' : '#FFFFFF'; + return ( 127 < $this->get_relative_luminance_from_hex( $background_color ) ) ? '#000' : '#fff'; } /**