Skip to content

Commit

Permalink
fix: correct linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
laurelfulford committed Nov 12, 2024
1 parent d123474 commit 8657289
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions includes/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,14 @@ function newspack_adjust_brightness( $hex, $steps ) {
$hex = str_repeat( substr( $hex, 0, 1 ), 2 ) . str_repeat( substr( $hex, 1, 1 ), 2 ) . str_repeat( substr( $hex, 2, 1 ), 2 );
}

// Split into three parts: R, G and B
// Split into three parts: R, G and B.
$color_parts = str_split( $hex, 2 );
$new_shade = '#';

foreach ( $color_parts as $color ) {
$color = hexdec( $color ); // Convert to decimal
$color = max( 0, min( 255, $color + $steps ) ); // Adjust color
$new_shade .= str_pad( dechex( $color ), 2, '0', STR_PAD_LEFT ); // Make two char hex code
$color = hexdec( $color ); // Convert to decimal.
$color = max( 0, min( 255, $color + $steps ) ); // Adjust color.
$new_shade .= str_pad( dechex( $color ), 2, '0', STR_PAD_LEFT ); // Make two char hex code.
}

return $new_shade;
Expand All @@ -579,12 +579,12 @@ function newspack_get_theme_colors() {
$secondary_color = get_theme_mod( 'secondary_color_hex', $default_secondary_color );

return [
'primary_color' => $primary_color,
'primary_text_color' => newspack_get_color_contrast( $primary_color ),
'primary_variation' => newspack_adjust_brightness( $primary_color, -40 ),
'secondary_color' => $secondary_color,
'secondary_text_color' => newspack_get_color_contrast( $secondary_color ),
'secondary_variation' => newspack_adjust_brightness( $secondary_color, -40 ),
'primary_color' => $primary_color,
'primary_text_color' => newspack_get_color_contrast( $primary_color ),
'primary_variation' => newspack_adjust_brightness( $primary_color, -40 ),
'secondary_color' => $secondary_color,
'secondary_text_color' => newspack_get_color_contrast( $secondary_color ),
'secondary_variation' => newspack_adjust_brightness( $secondary_color, -40 ),
];
}

Expand Down

0 comments on commit 8657289

Please sign in to comment.