Skip to content

Conversation

@enejb
Copy link
Member

@enejb enejb commented Nov 11, 2025

This PR adds a 3 filters that can be used to configure the amount of branding we want to show in the UI.

jetpack_accent_colour, lets you set the brand colour, default to the jetpack green. To remove the colour set this to inherit
jetpack_has_branding, lets you show the brand to the user. (this if false on wordpress.com )
jetpack_has_subtle_branding, lets you show the brand even in more subtyle ways. ( this is on in

setting jetpack_has_branding and jetpack_has_subtle_branding to false should not show any branding in the UI.

Proposed changes:

  • Centralized the getIconColour
  • Adds filter for changing the colour.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

Apply this PR .com simple site and notice to difference in branding.
Apply this PR to a jetpack site and notice no difference in branding.

Apply the follwoing filters. And notice that the jetpack icon is gone in the block-editor.

add_filter( `jetpack_has_branding`, '__return_false' );
add_filter( `jetpack_has_subtle_branding`, '__return_false' );
``

@enejb enejb requested review from a team and Copilot November 11, 2025 17:23
@enejb enejb added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Package] Forms labels Nov 11, 2025
@github-actions github-actions bot added [Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [JS Package] Script Data [JS Package] Shared Extension Utils [Package] Assets [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA labels Nov 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 11, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 2, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions
Copy link
Contributor

Are you an Automattician? The PR will need to be tested on WordPress.com. This comment will be updated with testing instructions as soon the build is complete.

Copilot finished reviewing on behalf of enejb November 11, 2025 17:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a platform configuration system to control Jetpack branding display throughout the UI. It adds three new filters (jetpack_accent_colour, jetpack_has_branding, and jetpack_has_subtle_branding) that allow platforms like WordPress.com to customize or remove Jetpack branding elements.

Key Changes:

  • Centralized the getIconColor() function and moved it from individual packages to @automattic/jetpack-shared-extension-utils
  • Added new platform configuration data structure with accent color and branding visibility settings
  • Implemented conditional rendering of Jetpack logos in block categories and form components based on branding settings

Reviewed Changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
projects/packages/assets/src/class-script-data.php Adds platform configuration data including accent color and branding flags, with three new filter hooks
projects/js-packages/script-data/src/utils.ts Implements helper functions accentColour(), hasBranding(), and hasSubtleBranding() to access platform configuration
projects/js-packages/script-data/src/types.ts Defines TypeScript types for the new PlatformData interface
projects/js-packages/shared-extension-utils/src/get-icon-color.js Refactors to use centralized accentColour() function from script-data
projects/js-packages/shared-extension-utils/src/block-icons.js Refactors to use centralized accentColour() function, removing duplicate logic
projects/plugins/jetpack/extensions/shared/block-category.js Conditionally displays Jetpack branding in block collections and categories based on platform settings
projects/packages/forms/src/dashboard/components/layout/index.tsx Conditionally renders Jetpack logo in Forms dashboard header based on subtle branding setting
projects/packages/forms/src/blocks/*/index.js (multiple) Updates import paths to use centralized getIconColor from shared-extension-utils
projects/packages/forms/src/blocks/shared/util/block-icons.js Removes duplicate getIconColor implementation in favor of centralized version
Various changelog files Documents the changes across affected packages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Significance: minor
Type: other

This is more internally relavent
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in changelog: "relavent" should be "relevant".

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +143
if ( isWpcomPlatformSite() ) {
// Return null to match core block styling
return null;
}
return getPlatformData()?.accent_colour || '#069e08'; // Jetpack green as default.
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for returning accentColour has a potential issue. When isWpcomPlatformSite() returns true, the function returns null to match core block styling. However, this bypasses the filter jetpack_accent_colour entirely for WordPress.com sites. If the intent is to allow WordPress.com sites to still use the filter to set a custom accent color, this early return prevents that. Consider checking the platform data first before deciding to return null.

Suggested change
if ( isWpcomPlatformSite() ) {
// Return null to match core block styling
return null;
}
return getPlatformData()?.accent_colour || '#069e08'; // Jetpack green as default.
const accentColour = getPlatformData()?.accent_colour;
if ( accentColour ) {
return accentColour;
}
if ( isWpcomPlatformSite() ) {
// Return null to match core block styling if no custom accent color is set
return null;
}
return '#069e08'; // Jetpack green as default.

Copilot uses AI. Check for mistakes.
*
* @since $$NEXT_VERSION$$
*
* @param string $colour The accent colour in HEX format.
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter documentation specifies the parameter as @param string $colour The accent colour in HEX format. which suggests only HEX values are expected. However, the PR description states "To remove the colour set this to inherit", suggesting a CSS keyword could be used. This inconsistency should be clarified - either update the documentation to indicate that CSS keywords like 'inherit' are also acceptable, or update the PR description if only HEX values are supported.

Suggested change
* @param string $colour The accent colour in HEX format.
* @param string $colour The accent colour in HEX format (e.g. "#069e08") or the CSS keyword 'inherit' to remove the colour.

Copilot uses AI. Check for mistakes.
Comment on lines +247 to +252
* should be displayed in the UI.
*
* @since $$NEXT_VERSION$$
*
* @param bool $has_branding Whether branding is enabled.
* @return bool The filtered branding state.
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete documentation comment. The comment on line 246 states "This determines if Jetpack logos, colors, and other branding elements should be displayed in the UI." but this is for subtle branding specifically. The comment should clarify that this is for subtle or less prominent display of branding elements, distinguishing it from the regular has_branding setting.

Suggested change
* should be displayed in the UI.
*
* @since $$NEXT_VERSION$$
*
* @param bool $has_branding Whether branding is enabled.
* @return bool The filtered branding state.
* should be displayed in a *subtle* or *less prominent* way in the UI,
* as opposed to the regular branding setting which may display them more prominently.
*
* @since $$NEXT_VERSION$$
*
* @param bool $has_branding Whether subtle branding is enabled.
* @return bool The filtered subtle branding state.

Copilot uses AI. Check for mistakes.
*
* @since $$NEXT_VERSION$$
*
* @param bool $has_branding Whether branding is enabled.
Copy link

Copilot AI Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment has incorrect parameter description. Line 251 says @param bool $has_branding Whether branding is enabled. but this is for the jetpack_has_subtle_branding filter, not the jetpack_has_branding filter. The parameter should be named $has_subtle_branding and the description should reference subtle branding.

Suggested change
* @param bool $has_branding Whether branding is enabled.
* @param bool $has_subtle_branding Whether subtle branding is enabled.

Copilot uses AI. Check for mistakes.
@jp-launch-control
Copy link

Code Coverage Summary

Cannot generate coverage summary while tests are failing. 🤐

Please fix the tests, or re-run the Code coverage job if it was something being flaky.

Full summary · PHP report · JS report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [JS Package] Script Data [JS Package] Shared Extension Utils [Package] Assets [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ RNA [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants