Skip to content

Commit

Permalink
Merge pull request #2224 from Automattic/master
Browse files Browse the repository at this point in the history
Alpha release Jan 26
  • Loading branch information
laurelfulford authored Jan 26, 2024
2 parents 38e695d + 87ad372 commit a9b0df7
Show file tree
Hide file tree
Showing 30 changed files with 174 additions and 398 deletions.
8 changes: 0 additions & 8 deletions newspack-joseph/inc/child-color-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,19 @@
* Add child theme-specific custom colours.
*/
function newspack_joseph_custom_colors_css() {
$primary_color = newspack_get_primary_color();
$secondary_color = newspack_get_secondary_color();
$header_color = '#111';

if ( 'default' !== get_theme_mod( 'theme_colors', 'default' ) ) {
$primary_color = get_theme_mod( 'primary_color_hex', $primary_color );
$secondary_color = get_theme_mod( 'secondary_color_hex', $secondary_color );

if ( 'default' !== get_theme_mod( 'header_color', 'default' ) ) {
$header_color = get_theme_mod( 'header_color_hex', '#666666' );
}

if ( 'default' !== get_theme_mod( 'footer_color', 'default' ) ) {
$footer_color = get_theme_mod( 'footer_color_hex', '' );
$footer_color_contrast = newspack_get_color_contrast( $footer_color );
}
}

// Set colour contrasts.
$primary_color_contrast = newspack_get_color_contrast( $primary_color );
$secondary_color_contrast = newspack_get_color_contrast( $secondary_color );
$header_color_contrast = newspack_get_color_contrast( $header_color );

$theme_css = '
Expand Down
64 changes: 3 additions & 61 deletions newspack-katharine/inc/child-color-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
* Add child theme-specific custom colours.
*/
function newspack_katharine_custom_colors_css() {
$primary_color = newspack_get_primary_color();
$secondary_color = newspack_get_secondary_color();
$header_color = '#333';

if ( 'default' !== get_theme_mod( 'theme_colors', 'default' ) ) {
$primary_color = get_theme_mod( 'primary_color_hex', $primary_color );
$secondary_color = get_theme_mod( 'secondary_color_hex', $secondary_color );

if ( 'default' !== get_theme_mod( 'header_color', 'default' ) ) {
$header_color = get_theme_mod( 'header_color_hex', '#666666' );
}
Expand All @@ -26,58 +21,13 @@ function newspack_katharine_custom_colors_css() {
}
}

$theme_css = '';
$editor_css = '';

// Set colour contrasts.
$primary_color_contrast = newspack_get_color_contrast( $primary_color );
$secondary_color_contrast = newspack_get_color_contrast( $secondary_color );
$header_color_contrast = newspack_get_color_contrast( $header_color );

$theme_css = '
.archive .page-title,
.entry-meta .byline a,
.entry-meta .byline a:visited,
.cat-links,
.cat-links a,
.cat-links a:visited,
.article-section-title,
.entry .entry-footer,
.accent-header,
#secondary .widgettitle {
color: ' . esc_html( newspack_color_with_contrast( $primary_color ) ) . ';
}
.mobile-sidebar .accent-header:before,
.mobile-sidebar div.wpnbha .article-section-title:before,
.mobile-sidebar .cat-links:before,
.mobile-sidebar figcaption:after,
.mobile-sidebar .wp-caption-text:after {
background-color: ' . esc_html( $primary_color_contrast ) . ';
}
@media only screen and (min-width: 782px) {
.featured-image-beside a,
.featured-image-beside a:visited,
.featured-image-beside .cat-links a {
color: ' . esc_html( $primary_color_contrast ) . ';
}
.featured-image-beside .cat-links:before {
background-color: ' . esc_html( $primary_color_contrast ) . ';
}
}
';

if ( true === get_theme_mod( 'header_solid_background', false ) ) {
$theme_css .= '
/* Featured Image Beside styles */
@media only screen and (min-width: 782px) {
.h-sb .featured-image-beside,
.h-sb .featured-image-beside a {
color: ' . esc_html( $primary_color_contrast ) . ';
}
}
';


if ( 'default' !== get_theme_mod( 'header_color', 'default' ) ) {
$theme_css .= '
/* Header solid background */
Expand Down Expand Up @@ -125,14 +75,6 @@ function newspack_katharine_custom_colors_css() {
';
}

$editor_css = '
.block-editor-block-list__layout .block-editor-block-list__block .entry-meta .byline a,
.block-editor-block-list__layout .block-editor-block-list__block.accent-header,
.block-editor-block-list__layout .block-editor-block-list__block .wp-block-newspack-blocks-homepage-articles:not(.has-text-color) .article-section-title {
color: ' . esc_html( newspack_color_with_contrast( $primary_color ) ) . ';
}
';

if ( function_exists( 'register_block_type' ) && is_admin() ) {
$theme_css = $editor_css;
}
Expand Down
2 changes: 1 addition & 1 deletion newspack-katharine/sass/style-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Newspack Katharine Editor Styles

.accent-header,
.article-section-title {
color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-primary-against-white );
font-size: var( --newspack-theme-font-size-xs );
margin-bottom: #{1.5 * structure.$size__spacing-unit};
margin-top: 0;
Expand Down
38 changes: 33 additions & 5 deletions newspack-katharine/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
.bottom-header-contain {
background-color: var( --newspack-theme-color-bg-dark-darken-5 );
}

.site-header,
.site-title a,
.site-title a:visited,
.site-description,
.middle-header-contain,
.middle-header-contain .nav1 .main-menu > li,
.middle-header-contain .nav1 .main-menu > li > a {
color: #fff;
}
}

// Mobile CTA
Expand All @@ -33,8 +43,9 @@
.article-section-title,
.cat-links,
.archive .page-title,
#secondary .widget-title,
#secondary .widgettitle {
color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-primary-against-white );

&::before {
background-color: var( --newspack-theme-color-primary );
Expand Down Expand Up @@ -80,6 +91,14 @@
.cat-links {
color: inherit;
}

.accent-header::before,
div.wpnbha .article-section-title::before,
.cat-links::before,
figcaption::after,
.wp-caption-text::after {
background-color: var( --newspack-theme-color-against-primary );
}
}

.accent-header,
Expand Down Expand Up @@ -115,7 +134,7 @@ div.wpnbha .article-section-title,
.cat-links a,
.cat-links a:hover,
.cat-links a:visited {
color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-primary-against-white );
}

.author-bio {
Expand Down Expand Up @@ -201,11 +220,11 @@ div.wpnbha .article-section-title,
@include utilities.media( tablet ) {
.featured-image-beside {
.cat-links a {
color: var( --newspack-theme-color-bg-body );
color: var( --newspack-theme-color-against-primary );
}

.cat-links::before {
background-color: var( --newspack-theme-color-bg-body );
background-color: var( --newspack-theme-color-against-primary );
}
}
}
Expand All @@ -227,7 +246,7 @@ div.wpnbha .article-section-title,
}

.entry .entry-footer {
color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-primary-against-white );
}

.entry .entry-footer a,
Expand Down Expand Up @@ -255,6 +274,15 @@ div.wpnbha .article-section-title,
// Header - Solid background
.h-sb .featured-image-beside {
background-color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-against-primary );

a {
color: inherit;
}

.cat-links::before {
background-color: var( --newspack-theme-color-against-primary );
}
}
}

Expand Down
32 changes: 2 additions & 30 deletions newspack-nelson/inc/child-color-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
*/
function newspack_nelson_custom_colors_css() {
$primary_color = newspack_get_primary_color();
$secondary_color = newspack_get_secondary_color();
$header_color = $primary_color;

if ( 'default' !== get_theme_mod( 'theme_colors', 'default' ) ) {
$primary_color = get_theme_mod( 'primary_color_hex', $primary_color );
$secondary_color = get_theme_mod( 'secondary_color_hex', $secondary_color );

if ( 'default' !== get_theme_mod( 'header_color', 'default' ) ) {
$header_color = get_theme_mod( 'header_color_hex', '#666666' );
Expand All @@ -29,30 +27,10 @@ function newspack_nelson_custom_colors_css() {
}

// Set colour contrasts.
$primary_color_contrast = newspack_get_color_contrast( $primary_color );
$secondary_color_contrast = newspack_get_color_contrast( $secondary_color );
$header_color_contrast = newspack_get_color_contrast( $header_color );

$theme_css = '
.site-header,
/* Header default background */
.h-db .site-header,
/* Header short height; default background */
.h-sh.h-db .site-header,
.site-content #primary,
#page .site-header,
.tec-wrapper {
border-color: ' . esc_html( newspack_adjust_brightness( $primary_color, -40 ) ) . ';
}
.site-footer {
color: ' . esc_html( $primary_color_contrast ) . ';
}
.has-drop-cap:not(:focus)::first-letter {
color: ' . esc_html( newspack_color_with_contrast( $secondary_color ) ) . ';
}
';
$theme_css = '';
$editor_css = '';

if ( true === get_theme_mod( 'header_solid_background', false ) ) {
$theme_css .= '
Expand Down Expand Up @@ -132,12 +110,6 @@ function newspack_nelson_custom_colors_css() {
';
}

$editor_css = '
.block-editor-block-list__layout .block-editor-block-list__block.has-drop-cap:not(:focus)::first-letter {
color: ' . esc_html( newspack_color_with_contrast( $secondary_color ) ) . ';
}
';

if ( function_exists( 'register_block_type' ) && is_admin() ) {
$theme_css = $editor_css;
}
Expand Down
2 changes: 1 addition & 1 deletion newspack-nelson/sass/style-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ blockquote {
}

.has-drop-cap:not( :focus )::first-letter {
color: var( --newspack-theme-color-secondary );
color: var( --newspack-theme-color-secondary-against-white );
font-family: var( --newspack-theme-font-heading );
font-weight: 800;
}
Expand Down
4 changes: 2 additions & 2 deletions newspack-nelson/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ blockquote {

//! Paragraph
.has-drop-cap:not( :focus )::first-letter {
color: var( --newspack-theme-color-secondary );
color: var( --newspack-theme-color-secondary-against-white );
font-family: var( --newspack-theme-font-heading );
font-weight: 800;
}
Expand Down Expand Up @@ -562,7 +562,7 @@ blockquote {

.site-footer {
background-color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-bg-body );
color: var( --newspack-theme-color-against-primary );

a,
a:hover,
Expand Down
47 changes: 2 additions & 45 deletions newspack-sacha/inc/child-color-patterns.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
* Add child theme-specific custom colours.
*/
function newspack_sacha_custom_colors_css() {
$primary_color = newspack_get_primary_color();
$secondary_color = newspack_get_secondary_color();
$header_color = '#333';

if ( 'default' !== get_theme_mod( 'theme_colors', 'default' ) ) {
$primary_color = get_theme_mod( 'primary_color_hex', $primary_color );
$secondary_color = get_theme_mod( 'secondary_color_hex', $secondary_color );

if ( 'default' !== get_theme_mod( 'header_color', 'default' ) ) {
$header_color = get_theme_mod( 'header_color_hex', '#666666' );
}
Expand All @@ -27,35 +22,10 @@ function newspack_sacha_custom_colors_css() {
}

// Set colour contrasts.
$primary_color_contrast = newspack_get_color_contrast( $primary_color );
$secondary_color_contrast = newspack_get_color_contrast( $secondary_color );
$header_color_contrast = newspack_get_color_contrast( $header_color );

$theme_css = '
.archive .page-title,
.h-sb .featured-image-beside .cat-links,
.entry-meta .byline a,
.entry-meta .byline a:visited,
.entry .entry-meta a:hover,
.accent-header,
#secondary .widgettitle,
.article-section-title,
.cat-links,
.entry .entry-footer,
.site-footer .widget .widget-title,
.site-footer .widget .widgettitle {
color: ' . esc_html( newspack_color_with_contrast( $primary_color ) ) . ';
}
.entry-meta .byline a:hover,
.entry-meta .byline a:hover:visited {
color: ' . esc_html( newspack_adjust_brightness( $primary_color, -40 ) ) . ';
}
.has-drop-cap:not(:focus)::first-letter {
color: ' . esc_html( $primary_color_contrast ) . ';
}
';
$theme_css = '';
$editor_css = '';

if ( true === get_theme_mod( 'header_solid_background', false ) ) {
if ( 'default' !== get_theme_mod( 'header_color', 'default' ) ) {
Expand Down Expand Up @@ -101,19 +71,6 @@ function newspack_sacha_custom_colors_css() {
';
}

$editor_css = '
.block-editor-block-list__layout .block-editor-block-list__block .entry-meta .byline a,
.block-editor-block-list__layout .block-editor-block-list__block.accent-header,
.block-editor-block-list__layout .block-editor-block-list__block .wp-block-newspack-blocks-homepage-articles:not(.has-text-color) .article-section-title {
color: ' . esc_html( newspack_color_with_contrast( $primary_color ) ) . ';
}
.block-editor-block-list__layout .block-editor-block-list__block.has-drop-cap:not(:focus)::first-letter {
color: ' . esc_html( $primary_color_contrast ) . ';
}
';

if ( function_exists( 'register_block_type' ) && is_admin() ) {
$theme_css = $editor_css;
}
Expand Down
4 changes: 2 additions & 2 deletions newspack-sacha/sass/style-editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ h1.wp-block-post-title,
.accent-header,
.article-section-title {
align-items: center;
color: var( --newspack-theme-color-primary );
color: var( --newspack-theme-color-primary-against-white );
display: flex;
font-size: var( --newspack-theme-font-size-xs );
margin-bottom: #{1.5 * structure.$size__spacing-unit};
Expand Down Expand Up @@ -46,7 +46,7 @@ h1.wp-block-post-title,

.has-drop-cap:not( :focus )::first-letter {
background-color: var( --newspack-theme-color-primary );
color: #fff;
color: var( --newspack-theme-color-against-primary );
font-family: var( --newspack-theme-font-heading );
font-weight: bold;
font-size: var( --newspack-theme-font-size-xxl );
Expand Down
Loading

0 comments on commit a9b0df7

Please sign in to comment.