diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index 06ebb77c37658..68b67df793f66 100644 --- a/src/wp-admin/css/common.css +++ b/src/wp-admin/css/common.css @@ -1499,13 +1499,25 @@ th.action-links { 4.0 - Notifications ------------------------------------------------------------------------------*/ +/* + * Tone is carried by the surface, a full hairline border and the text colour. + * Padding, paragraph margins and the dismiss button's position are unchanged: + * plugins position their own elements against the inside of this box, so only + * its paint may change here. + * + * Paint comes from design system tokens, so a notice follows the theme the + * tokens resolve to. Geometry stays in literal values for the same reason the + * box may not move. The tokens are defined by the wp-theme stylesheet, which + * this one depends on, so no var() fallbacks are needed. + */ .notice, div.updated, div.error { - background: #fff; - border: none; - border-left: 4px solid #c3c4c7; + background: var(--wpds-color-background-surface-neutral-weak); + border: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral); + border-radius: var(--wpds-border-radius-lg); box-shadow: none; + color: var(--wpds-color-foreground-content-neutral); margin: 5px 15px 2px; padding: 8px 12px; } @@ -1523,7 +1535,7 @@ div.error p, padding: 0; font-size: 13px; line-height: 1.54; - color: #1e1e1e; + color: inherit; } div.notice a, @@ -1557,7 +1569,7 @@ div.updated a:focus { .notice-title { display: inline-block; - color: #1d2327; + color: inherit; font-size: 18px; } @@ -1574,19 +1586,26 @@ div.updated a:focus { margin: 0; padding: 0; background: none; - color: #1e1e1e; + /* Takes the notice's tone. */ + color: inherit; cursor: pointer; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; - border-radius: 2px; + /* A compact control inside the notice, so it takes the small radius rather than the notice's own container radius. */ + border-radius: var(--wpds-border-radius-sm); +} + +/* The glyph follows the button, so a plugin that colours the button colours the icon. */ +.notice-dismiss::before { + color: inherit; } .notice-dismiss:hover::before, .notice-dismiss:active::before { - color: #1e1e1e; + color: inherit; opacity: 0.7; } @@ -1597,47 +1616,51 @@ div.updated a:focus { } .notice-dismiss:focus::before { - color: #1e1e1e; + color: inherit; } .notice-success, div.updated { - border-left-color: #4ab866; - background-color: #eff9f1; + border-color: var(--wpds-color-stroke-surface-success); + background-color: var(--wpds-color-background-surface-success-weak); + color: var(--wpds-color-foreground-content-success); } .notice-success.notice-alt, div.updated.notice-alt { - background-color: #eff9f1; + background-color: var(--wpds-color-background-surface-success-weak); } .notice-warning { - border-left-color: #f0b849; - background-color: #fef8ee; + border-color: var(--wpds-color-stroke-surface-warning); + background-color: var(--wpds-color-background-surface-warning-weak); + color: var(--wpds-color-foreground-content-warning); } .notice-warning.notice-alt { - background-color: #fef8ee; + background-color: var(--wpds-color-background-surface-warning-weak); } .notice-error, div.error { - border-left-color: #cc1818; - background-color: #fcf0f0; + border-color: var(--wpds-color-stroke-surface-error); + background-color: var(--wpds-color-background-surface-error-weak); + color: var(--wpds-color-foreground-content-error); } .notice-error.notice-alt, div.error.notice-alt { - background-color: #fcf0f0; + background-color: var(--wpds-color-background-surface-error-weak); } .notice-info { - border-left-color: #3858e9; - background-color: #fff; + border-color: var(--wpds-color-stroke-surface-info); + background-color: var(--wpds-color-background-surface-info-weak); + color: var(--wpds-color-foreground-content-info); } .notice-info.notice-alt { - background-color: #fff; + background-color: var(--wpds-color-background-surface-info-weak); } #plugin-information-footer .update-now:not(.button-disabled)::before { diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css index b53baf94744de..231e8014bba63 100644 --- a/src/wp-admin/css/customize-controls.css +++ b/src/wp-admin/css/customize-controls.css @@ -1207,6 +1207,8 @@ p.customize-section-description { margin: 0 0 6px; padding: 9px 14px; overflow: hidden; + /* Notifications span the panel's full width, so they are bands rather than boxes. */ + border-radius: 0; } #customize-controls .customize-control-notifications-container .notice.is-dismissible { @@ -1269,6 +1271,8 @@ p.customize-section-description { #customize-controls .panel-meta > .customize-control-notifications-container .notice, #customize-controls .customize-section-title > .customize-control-notifications-container .notice { padding: 9px 14px; + /* Stacked flush against the panel's edges and each other, so no corners. */ + border-radius: 0; } #customize-controls #customize-notifications-area .notice.is-dismissible, @@ -1296,7 +1300,8 @@ p.customize-section-description { #customize-controls .notice.notification-overlay, #customize-controls #customize-notifications-area .notice.notification-overlay { margin: 0; - border-left: 0; /* @todo Appropriate styles could be added for notice-error, notice-warning, notice-success, etc */ + border: 0; /* @todo Appropriate styles could be added for notice-error, notice-warning, notice-success, etc */ + border-radius: 0; } #customize-controls .customize-control-notifications-container.has-overlay-notifications { diff --git a/src/wp-admin/css/login.css b/src/wp-admin/css/login.css index 1489356612442..a715da86ea1ff 100644 --- a/src/wp-admin/css/login.css +++ b/src/wp-admin/css/login.css @@ -39,15 +39,23 @@ p { line-height: 1.5; } +/* + * The login screen renders its messages through wp_admin_notice(), so the markup + * is the admin's. It does not load common.css, so the notice paint is repeated + * here; both stylesheets read the same tokens, which is what keeps the two in + * agreement. Padding and margins are unchanged, so only the paint moves. + */ .login .message, .login .notice, .login .success { - border-left: 4px solid #3858e9; + background: var(--wpds-color-background-surface-neutral-weak); + border: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral); + border-radius: var(--wpds-border-radius-lg); + color: var(--wpds-color-foreground-content-neutral); padding: 8px 12px; margin-top: 0; margin-left: 0; margin-bottom: 20px; - background-color: #fff; word-wrap: break-word; } @@ -59,15 +67,31 @@ p { margin: 0.5em 0; } -.login .success { - border-left-color: #4ab866; - background-color: #eff9f1; +/* An instructional message is rendered as an info notice, so it takes that tone. */ +.login .message, +.login .notice-info { + border-color: var(--wpds-color-stroke-surface-info); + background-color: var(--wpds-color-background-surface-info-weak); + color: var(--wpds-color-foreground-content-info); +} + +.login .success, +.login .notice-success { + border-color: var(--wpds-color-stroke-surface-success); + background-color: var(--wpds-color-background-surface-success-weak); + color: var(--wpds-color-foreground-content-success); +} + +.login .notice-warning { + border-color: var(--wpds-color-stroke-surface-warning); + background-color: var(--wpds-color-background-surface-warning-weak); + color: var(--wpds-color-foreground-content-warning); } -/* Match border color from common.css */ .login .notice-error { - border-left-color: #cc1818; - background-color: #fcf0f0; + border-color: var(--wpds-color-stroke-surface-error); + background-color: var(--wpds-color-background-surface-error-weak); + color: var(--wpds-color-foreground-content-error); } .login .login-error-list { diff --git a/src/wp-admin/css/themes.css b/src/wp-admin/css/themes.css index 2c59593f4392b..be9e12ec27b07 100644 --- a/src/wp-admin/css/themes.css +++ b/src/wp-admin/css/themes.css @@ -46,6 +46,12 @@ body.js .theme-browser.search-loading { position: absolute; right: 0; top: 0; + /* + * The message is a band pinned to the card's edges, not a box of its own. + * The card already clips it to the card's own corner radius, so a radius + * here would only pull the band away from that corner. + */ + border-radius: 0; } /** diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index ef81a42106e88..c4a42d5c507c8 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1592,7 +1592,13 @@ function wp_default_styles( $styles ) { // Admin CSS. $styles->add( 'wp-tooltip', "/wp-admin/css/wp-tooltip$suffix.css", array( 'dashicons' ) ); - $styles->add( 'common', "/wp-admin/css/common$suffix.css" ); + /* + * The notice styles in common.css paint from design system tokens, which the + * wp-theme stylesheet defines. The dependency is declared per stylesheet rather + * than on the wp-admin bundle so that the tokens also load on screens that + * enqueue common.css on its own. + */ + $styles->add( 'common', "/wp-admin/css/common$suffix.css", array( 'wp-theme' ) ); $styles->add( 'forms', "/wp-admin/css/forms$suffix.css" ); $styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" ); $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" ); @@ -1611,7 +1617,12 @@ function wp_default_styles( $styles ) { $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n', 'wp-base-styles', 'wp-tooltip' ) ); - $styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n', 'wp-base-styles', 'wp-tooltip' ) ); + /* + * The login screen paints its messages from design system tokens, which the + * wp-theme stylesheet defines. It does not load common.css, so the dependency + * is declared here as well. + */ + $styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'wp-theme', 'dashicons', 'buttons', 'forms', 'l10n', 'wp-base-styles', 'wp-tooltip' ) ); $styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n', 'wp-base-styles' ) ); $styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" ); $styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'imgareaselect' ) );