PluginProbe
Code Snippets / trunk
Code Snippets vtrunk
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / css / common / _badges.scss

_badges.scss in Code Snippets trunk, at css/common/_badges.scss

179 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 @use 'sass:map';
2 @use 'sass:list';
3 @use 'theme';
4
5 .badge {
6 font-size: 12px;
7 font-weight: 700;
8 text-transform: uppercase;
9 border-radius: 5px;
10 text-align: center;
11 min-inline-size: 43px;
12 min-block-size: 24px;
13 display: inline-flex;
14 justify-content: center;
15 align-items: center;
16 padding-block: 0;
17 padding-inline: 3px;
18 box-sizing: border-box;
19 gap: 5px;
20 line-height: 1;
21
22 @at-root .row-actions & {
23 color: #8c8c8c;
24 padding-inline: 0;
25 text-transform: capitalize;
26 font-weight: 500;
27 }
28
29 .dashicons {
30 font-size: 18px;
31 inline-size: 18px;
32 block-size: 18px;
33 }
34 }
35
36 .network-shared {
37 color: var(--cs-color-accent);
38 font-size: 22px;
39 inline-size: 100%;
40 cursor: help;
41 }
42
43 .small-badge {
44 block-size: auto;
45 inline-size: auto;
46 font-size: smaller;
47 padding-block: 0;
48 padding-inline: 0.5em;
49 }
50
51 .wp-core-ui .button.nav-tab-button {
52 margin-inline-start: 0.5em;
53 float: inline-end;
54 color: var(--cs-color-text-disabled);
55 background: var(--cs-color-surface-subtle);
56 border-color: var(--cs-color-surface-subtle);
57 align-self: center;
58 display: flex;
59 justify-content: center;
60 align-items: center;
61 gap: 2px;
62 }
63
64 .nav-tab-button .dashicons-external {
65 font-size: 15px;
66 color: #666;
67 }
68
69 /* format: background-color [color] */
70 $badges: (
71 // php/html/cond darkened for WCAG AA — at least 4.5:1 against white 12px
72 // bold text; php reuses the accent token, html/cond keep hue at reduced lightness.
73 php: #2271b1,
74 html: #cd4510,
75 css: #9b59b6,
76 js: #f7d67a #1c1f20,
77 cond: #22826f,
78 core: #0ca0a9,
79 pro: #f7e8e3 #df9279,
80 revisions: #50575e,
81 cloud: #009fb4,
82 bundles: #50575e,
83 cloud_search: #d27c00,
84 private: #f7e6be #a27813,
85 public: #dbebf7 #2271b1,
86 success: #d3e8d1 #447340,
87 failure: #fad7c1 #a24b16,
88 info: #d2e6f4 #2b71a3,
89 neutral: #f6f7f7 #646970,
90 neutralDark: #e2e5e5 #6c7e7e,
91 special: #dfc5ef #6e249c
92 );
93
94 @each $name, $colors in $badges {
95 $text-color: #fff;
96 $background-color: list.nth($colors, 1);
97
98 @if list.length($colors) > 1 {
99 $text-color: list.nth($colors, 2);
100 }
101
102 .badge.#{$name}-badge,
103 .nav-tab-inactive:hover .badge.#{$name}-badge,
104 :hover > .inverted-badges .#{$name}-badge {
105 color: $text-color;
106 background-color: $background-color;
107 }
108
109 a.badge.#{$name}-badge:hover,
110 button.badge.#{$name}-badge:hover {
111 color: $text-color;
112 background-color: color-mix(in srgb, $background-color 95%, #000 5%);
113 }
114 }
115
116 // #646970 (WP gray-50) keeps white badge text at 5.5:1 so locked/unlicensed
117 // states stay WCAG AA without hover; #a7aaad was 2.3:1.
118 .nav-tab-inactive .badge,
119 .inverted-badges .badge {
120 color: #fff;
121 background-color: #646970;
122 border-color: #fff !important;
123
124 .dashicons {
125 color: #fff;
126 }
127 }
128
129 .nav-tab-inactive {
130 $colors: map.get($badges, 'pro');
131 $text-color: list.nth($colors, 2);
132 $background-color: list.nth($colors, 1);
133
134 background: transparent;
135
136 .badge.pro-badge {
137 color: $text-color;
138 background-color: $background-color;
139 }
140
141 &:hover {
142 &.button, .dashicons-external {
143 color: #3c434a;
144 }
145
146 .badge.pro-badge {
147 color: $background-color;
148 background-color: $text-color;
149 }
150 }
151 }
152
153 // Override WordPress' .wp-core-ui .button .dashicons { line-height: 1.9 } —
154 // inside a button the inflated line-box would shift the glyph below the
155 // badge's bottom border. Placed at end-of-file so it follows all other
156 // .dashicons rules in source order (no-descending-specificity).
157 .wp-core-ui .button .badge .dashicons {
158 line-height: 1;
159 }
160
161 // Pro badge consolidated to the navigation pro-chip style: a light accent pill
162 // in every context, overriding the badge colour map and the inverted/nav-tab
163 // variants (whose white !important border must be beaten here). This is a
164 // deliberate final override, so it intentionally follows higher-specificity
165 // context rules above.
166 /* stylelint-disable no-descending-specificity */
167 .badge.pro-badge,
168 .inverted-badges .badge.pro-badge,
169 .nav-tab-inactive .badge.pro-badge {
170 color: var(--cs-color-accent);
171 background-color: var(--cs-color-surface-info);
172 border: 1px solid rgb(34 113 177 / 10%) !important;
173 border-radius: 999px;
174 padding-block: 3px;
175 padding-inline: 10px;
176 line-height: normal;
177 }
178 /* stylelint-enable no-descending-specificity */
179