Docs

Checkbox Color and Text SizeNew

4 min readUpdated November 24, 2026

The consent checkbox can match your brand. Two settings on the General tab control how it looks on every form and checkout: – Checkbox color: your brand color. – Checkbox text size: the size of the label.

Your theme or a branding plugin can also set both for you.

WooCommerce block checkout consent checkbox before, with theme defaults, and after, with Checkbox color #2e7a2f and Checkbox text size 17px

Before you start#

  • WP Smart Consent 1.5.5 or newer. Checkbox color exists in earlier versions; Checkbox text size and the API for other plugins are new in 1.5.5.
  • At least one checkout or form plugin connected, so the checkbox appears on your site.

Setting the color and text size#

  1. Go to WP Smart Consent → General.
  2. In Checkbox color, enter a hex color such as #2e7a2f.
  3. In Checkbox text size, enter a size such as 15px.
  4. Click Save.
The General tab's Consent checkbox card with Checkbox color set to #2e7a2f and Checkbox text size set to 15px
Setting Default What it does
Checkbox color Empty (browser default) The color of the ticked checkbox. Use #rgb or #rrggbb. Something that isn’t a hex color is cleared when you save.
Checkbox text size Empty (each form’s own size) The font size of the checkbox label. Use px, em, rem or %, from 10px to 32px; em, rem and % are measured against 16px, and a plain number means px. Something outside that range is cleared when you save.

Leave a field blank to go back to the default.

Where they apply#

Both settings apply to the consent checkbox in every checkout and form plugin WP Smart Consent supports. That includes the WooCommerce block checkout, Forminator and HappyForms, which draw their own checkbox: there, the color fills the ticked box and the tick turns white.

  • Text size changes the label only. The checkbox itself keeps the size your theme or form plugin gives it.
  • Quill Forms asks for consent as a question, not a checkbox, so these settings don’t affect it.

When a plugin sets them for you#

A theme, branding or design-system plugin can save your brand color and checkbox text size into WP Smart Consent. The field then shows which plugin set it:

Checkbox color and Checkbox text size on the General tab, each with the note Set by Acme Brand Kit. You can still change it here.

You can still change the value yourself. As soon as you save a different value, the note disappears and your value is used.

A plugin can also override a setting on the front end without saving it. The field then says Code on this site overrides this setting on the front end and shows the value in use. To change it, change the setting in that plugin or theme.

For developers#

Save a value into the settings#

Use this when your plugin manages the site’s branding. The value is saved as if an admin typed it, and the dashboard shows the name you pass.

add_action( 'init', function () {
    // Safe to call even when WP Smart Consent isn't active.
    do_action( 'wpsc_set_brand_color', '#2e7a2f', 'Acme Brand Kit' );
    do_action( 'wpsc_set_checkbox_font_size', '15px', 'Acme Brand Kit' );
} );

The functions do the same and return true or a WP_Error:

if ( function_exists( 'wpsc_set_brand_color' ) ) {
    $result = wpsc_set_brand_color( '#2e7a2f', 'Acme Brand Kit' );
    if ( is_wp_error( $result ) ) {
        error_log( $result->get_error_message() );
    }
    wpsc_set_checkbox_font_size( '0.95em', 'Acme Brand Kit' );
}
  • Color: a hex color such as #2e7a2f, 2e7a2f or #abc.
  • Text size: px, em, rem or %, between 10px and 32px. A number means px.
  • Clearing: pass '' to go back to the default.
  • Invalid values: a WP_Error is returned, and the setting is unchanged.

The value is only written when it changes, so calling these on every request is harmless. Calling them when your own branding settings change is still cleaner.

Override at runtime#

Use the filters when the value should come from your code without being saved, for example per page or per language:

add_filter( 'wpsc_brand_color', function ( $color ) {
    return get_theme_mod( 'accent_color', $color );
} );

add_filter( 'wpsc_checkbox_font_size', function ( $size ) {
    return is_checkout() ? '14px' : $size;
} );

Each filter receives the saved value. An invalid return value is ignored and the saved value is used.

Reading the values in use#

$color = wpsc_get_brand_color();        // '#2e7a2f', or '' for the default
$size  = wpsc_get_checkbox_font_size(); // '15px', or '' for each form's own size

On pages where they’re set, both are also available to your CSS as --wpsc-brand and --wpsc-optin-font-size:

.my-signup-note {
    color: var(--wpsc-brand, #333);
    font-size: var(--wpsc-optin-font-size, 15px);
}

Hooks#

Hook Type Use
wpsc_set_brand_color action ( $color, $source ): save the brand color
wpsc_set_checkbox_font_size action ( $size, $source ): save the text size
wpsc_brand_color filter Brand color in use on the front end
wpsc_checkbox_font_size filter Text size in use on the front end
wpsc_brand_updated action ( $key, $value, $before, $source ): fires after either value is saved through the API. $key is color or font_size
wpsc_checkbox_label_selectors filter CSS selectors that receive the text size

If you show the checkbox in your own markup (see Build a Custom Integration), put the <input type="checkbox" data-wpsc-optin="1"> directly inside its <label>. It then picks up both settings with no extra code. Otherwise, add your label’s selector:

add_filter( 'wpsc_checkbox_label_selectors', function ( $selectors ) {
    $selectors[] = '.my-form .consent-text';
    return $selectors;
} );

Troubleshooting#

The text size doesn’t change. – Check that the value is between 10px and 32px. Values outside the range are cleared on save. – Check for the note Code on this site overrides this setting. If it’s there, the value comes from your theme or a plugin. – Clear your page cache.

The color doesn’t change. – Check that the field still holds your color after saving. Anything that isn’t a hex color, such as green, is cleared. – Some themes style checkboxes with their own CSS. WP Smart Consent’s rules take priority, but a theme that replaces the checkbox with an image can still win.

A plugin keeps putting its value back. That plugin saves its value whenever its own settings are saved, or on every page load. Change the color or size in that plugin instead.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only