# code-snippets/trunk/css/common/_badges.scss

Code Snippets, version trunk. 179 lines.

- Page: https://pluginprobe.com/plugins/code-snippets/trunk/code/css/common/_badges.scss
- Raw: https://pluginprobe.com/plugins/code-snippets/trunk/raw/css/common/_badges.scss
- Modified: 2026-09-22T07:42:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-snippets/trunk/code/css/common/_badges.scss#L10-L20`.

```scss
@use 'sass:map';
@use 'sass:list';
@use 'theme';

.badge {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	border-radius: 5px;
	text-align: center;
	min-inline-size: 43px;
	min-block-size: 24px;
	display: inline-flex;
	justify-content: center;
	align-items: center;
	padding-block: 0;
	padding-inline: 3px;
	box-sizing: border-box;
	gap: 5px;
	line-height: 1;

	@at-root .row-actions & {
		color: #8c8c8c;
		padding-inline: 0;
		text-transform: capitalize;
		font-weight: 500;
	}

	.dashicons {
		font-size: 18px;
		inline-size: 18px;
		block-size: 18px;
	}
}

.network-shared {
	color: var(--cs-color-accent);
	font-size: 22px;
	inline-size: 100%;
	cursor: help;
}

.small-badge {
	block-size: auto;
	inline-size: auto;
	font-size: smaller;
	padding-block: 0;
	padding-inline: 0.5em;
}

.wp-core-ui .button.nav-tab-button {
	margin-inline-start: 0.5em;
	float: inline-end;
	color: var(--cs-color-text-disabled);
	background: var(--cs-color-surface-subtle);
	border-color: var(--cs-color-surface-subtle);
	align-self: center;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 2px;
}

.nav-tab-button .dashicons-external {
	font-size: 15px;
	color: #666;
}

/* format: background-color [color] */
$badges: (
	// php/html/cond darkened for WCAG AA — at least 4.5:1 against white 12px
	// bold text; php reuses the accent token, html/cond keep hue at reduced lightness.
	php: #2271b1,
	html: #cd4510,
	css: #9b59b6,
	js: #f7d67a #1c1f20,
	cond: #22826f,
	core: #0ca0a9,
	pro: #f7e8e3 #df9279,
	revisions: #50575e,
	cloud: #009fb4,
	bundles: #50575e,
	cloud_search: #d27c00,
	private: #f7e6be #a27813,
	public: #dbebf7 #2271b1,
	success: #d3e8d1 #447340,
	failure: #fad7c1 #a24b16,
	info: #d2e6f4 #2b71a3,
	neutral: #f6f7f7 #646970,
	neutralDark: #e2e5e5 #6c7e7e,
	special: #dfc5ef #6e249c
);

@each $name, $colors in $badges {
	$text-color: #fff;
	$background-color: list.nth($colors, 1);

	@if list.length($colors) > 1 {
		$text-color: list.nth($colors, 2);
	}

	.badge.#{$name}-badge,
	.nav-tab-inactive:hover .badge.#{$name}-badge,
	:hover > .inverted-badges .#{$name}-badge {
		color: $text-color;
		background-color: $background-color;
	}

	a.badge.#{$name}-badge:hover,
	button.badge.#{$name}-badge:hover {
		color: $text-color;
		background-color: color-mix(in srgb, $background-color 95%, #000 5%);
	}
}

// #646970 (WP gray-50) keeps white badge text at 5.5:1 so locked/unlicensed
// states stay WCAG AA without hover; #a7aaad was 2.3:1.
.nav-tab-inactive .badge,
.inverted-badges .badge {
	color: #fff;
	background-color: #646970;
	border-color: #fff !important;

	.dashicons {
		color: #fff;
	}
}

.nav-tab-inactive {
	$colors: map.get($badges, 'pro');
	$text-color: list.nth($colors, 2);
	$background-color: list.nth($colors, 1);

	background: transparent;

	.badge.pro-badge {
		color: $text-color;
		background-color: $background-color;
	}

	&:hover {
		&.button, .dashicons-external {
			color: #3c434a;
		}

		.badge.pro-badge {
			color: $background-color;
			background-color: $text-color;
		}
	}
}

// Override WordPress' .wp-core-ui .button .dashicons { line-height: 1.9 } —
// inside a button the inflated line-box would shift the glyph below the
// badge's bottom border. Placed at end-of-file so it follows all other
// .dashicons rules in source order (no-descending-specificity).
.wp-core-ui .button .badge .dashicons {
	line-height: 1;
}

// Pro badge consolidated to the navigation pro-chip style: a light accent pill
// in every context, overriding the badge colour map and the inverted/nav-tab
// variants (whose white !important border must be beaten here). This is a
// deliberate final override, so it intentionally follows higher-specificity
// context rules above.
/* stylelint-disable no-descending-specificity */
.badge.pro-badge,
.inverted-badges .badge.pro-badge,
.nav-tab-inactive .badge.pro-badge {
	color: var(--cs-color-accent);
	background-color: var(--cs-color-surface-info);
	border: 1px solid rgb(34 113 177 / 10%) !important;
	border-radius: 999px;
	padding-block: 3px;
	padding-inline: 10px;
	line-height: normal;
}
/* stylelint-enable no-descending-specificity */

```
