WordPress.org

Make WordPress Core

Ticket #49711: 49711.patch

File 49711.patch, 2.7 KB (added by samful, 13 months ago)

samful's patch for adding themed gradients to the 2020 theme

  • wp-content/themes/twentytwenty/functions.php

    diff --git wp-content/themes/twentytwenty/functions.php wp-content/themes/twentytwenty/functions.php
    index f37c76a..74cbcac 100644
    function twentytwenty_theme_support() { 
    135135        // Add theme support for selective refresh for widgets.
    136136        add_theme_support( 'customize-selective-refresh-widgets' );
    137137
     138        // Add theme support for block gradient colours.
     139        add_theme_support(
     140                'editor-gradient-presets',
     141                array(
     142                        array(
     143                                'name'     => __( 'pink to dark pink', 'twentytwenty' ),
     144                                'gradient' => 'linear-gradient(135deg,rgba(205, 38, 83, 1) 0%, rgba(99, 30, 44, 1) 100%)',
     145                                'slug'     => 'pink-to-dark-pink'
     146                        ),
     147                        array(
     148                                'name'     => __( 'black to pink', 'twentytwenty' ),
     149                                'gradient' => 'linear-gradient(135deg,rgba(34, 34, 34, 1) 0%, rgba(205, 38, 83, 1) 100%)',
     150                                'slug'     => 'black-to-pink',
     151                        ),
     152                        array(
     153                                'name'     => __( 'cream to pink to black', 'twentytwenty' ),
     154                                'gradient' => 'linear-gradient(135deg,rgba(245, 239, 224, 1) 0%, rgba(205, 38, 83, 1) 50%, rgba(34, 34, 34, 1) 100%)',
     155                                'slug'     =>  'cream-to-pink-to-black',
     156                        ),
     157                        array(
     158                                'name'     => __( 'mid dark pink to pink', 'twentytwenty' ),
     159                                'gradient' => 'linear-gradient(135deg,rgba(133, 39, 59, 1) 0%, rgba(205, 38, 83, 1) 100%)',
     160                                'slug'     => 'mid-dark-pink-to-pink',
     161                        ),
     162                        array(
     163                                'name'     => __( 'Blush bordeaux', 'twentytwenty' ),
     164                                'gradient' => 'linear-gradient(135deg, rgb(254, 205, 165) 0%, rgb(254, 45, 45) 50%, rgb(107, 0, 62) 100%)',
     165                                'slug'     =>  'blush-bordeaux',
     166                        )
     167                )
     168        );
     169
    138170        /*
    139171         * Adds `async` and `defer` support for scripts registered or enqueued
    140172         * by the theme.
  • wp-content/themes/twentytwenty/style.css

    diff --git wp-content/themes/twentytwenty/style.css wp-content/themes/twentytwenty/style.css
    index ad794b9..5659b98 100644
    h2.entry-title { 
    27872787        color: #000;
    27882788}
    27892789
     2790/* Block Custom Gradient Backgrounds --------- */
     2791
     2792.has-pink-to-dark-pink-gradient-background{
     2793    background: linear-gradient(135deg,rgba(205, 38, 83, 1) 0%, rgba(99, 30, 44, 1) 100%);
     2794}
     2795
     2796.has-black-to-pink-gradient-background{
     2797    background: linear-gradient(135deg,rgba(34, 34, 34, 1) 0%, rgba(205, 38, 83, 1) 100%);
     2798}
     2799
     2800.has-cream-to-pink-to-black-gradient-background{
     2801    background: linear-gradient(135deg,rgba(245, 239, 224, 1) 0%, rgba(205, 38, 83, 1) 50%, rgba(34, 34, 34, 1) 100%);
     2802}
     2803
     2804.has-mid-dark-pink-to-pink-gradient-background{
     2805    background: linear-gradient(135deg,rgba(133, 39, 59, 1) 0%, rgba(205, 38, 83, 1) 100%);
     2806}
    27902807
    27912808/* Block Typography Classes ------------------ */
    27922809