= 6 ? 6 : 3; $rows = $count > 6 ? 2 : 1; $rows_mobile = $count > 6 ? 4 : 1; $html = <<
HTML; $on_click = <<{ copied.classList.remove('has-display-block'); copied.classList.add('has-display-none' ); }, 1000); JS; foreach ( $shades as $shade => $hex ) { $color = $name . '-' . $shade; if ( in_array( $shade, Color::SYSTEM_COLORS, true ) ) { $color = $shade; } $on_click_value = Str::reduce_whitespace( Str::remove_line_breaks( str_replace( '{hex}', $hex, $on_click ) ) ); $html .= <<

$color: $hex

Copied!

HTML; } $html .= << HTML; return $html; } foreach ( $color_palette as $color ) { $exploded = explode( '-', $color['slug'] ); $name = $exploded[0] ?? ''; $shade = $exploded[1] ?? ''; if ( in_array( $name, $system_colors, true ) ) { continue; } if ( ! isset( $colors[ $name ] ) ) { $colors[ $name ] = []; } $colors[ $name ][ $shade ] = $color['color']; } $width_50 = 'calc(50% - (var(--wp--style--block-gap) / 2))'; $system = [ 'current' => 'currentColor', 'inherit' => 'inherit', 'transparent' => 'transparent', ]; ?>
$shades ) : ?>