`s * inherit; `fill-rule="evenodd"` does not match `fill="` — re-encodes it (116) and sets it as * an inline `background-image … !important` (125). The colour is `current` when the `
  • ` * carries `current` or `wp-has-current-submenu`, otherwise `base`, then `focus` on mouseenter * and `base` again 100ms after mouseleave (52-69); the three hex values are * `_wpColorScheme.icons`, which wp_color_scheme_settings() prints for the user's scheme * (30-35). So the fill written in the file is never what the painted icon shows — the * painter overwrites it whatever it says — and it only matters before the painter runs, or * with JS off, when the browser draws the file as delivered. The designer's file says * `currentColor` there, and an SVG loaded as an image has no `color` to inherit, so that drew * black on the dark sidebar until the footer script ran (the designer's data URI drawn onto * a canvas reads 0,0,0 at the bubble; this one reads 167,170,173). `#a7aaad` is the Default * scheme's resting icon colour (its `icons.base`), so on that scheme the unpainted icon is * the grey the painted one settles on, and on any other it is a sidebar grey until the * painter runs. * * Embedded rather than read at registration: admin_menu fires on every request that builds * the site admin's menu (wp-admin/admin.php loads menu.php, which ends by loading * includes/menu.php, where it fires; the network and user admins fire their own action there * instead, admin-ajax.php and admin-post.php load no menu at all, and upgrade.php, install.php * and setup-config.php never load admin.php), and a value fixed at release time is not worth * reading and base64-encoding the file on each of those requests. * tests/Unit/Admin/MenuTest.php decodes this constant against the file's bytes and requires * exactly one `fill="…"` in it, `#a7aaad`, and no `currentColor`, so the file stays the source * of truth. When the mark changes: set that root fill in the new file and remove any other * `fill="…"`, paste `base64 -w0 assets/img/menu-icon.svg` here, and re-check the prose above * that describes this file (that its one fill sits on the root ``, the ``s that * inherit it, the canvas reading), which no test holds. MenuTest fails while either of the * first two is undone. */ public const ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIGZpbGw9IiNhN2FhYWQiPjxwYXRoIGQ9Ik0yMiA2QzE5LjggNSAxOC4yIDYuNiAxOSA5QzE4IDE5IDIyIDM0IDMxIDQ0QzM1LjUgNDEgMzkgNDAuNSA0MyA0MUMzNyAzMSAyOSAxNiAyMiA2WiIvPjxwYXRoIGQ9Ik03NiA1Qzc4LjIgNCA3OS44IDUuNiA3OSA4QzgwIDE4IDc2IDMzIDY3IDQ0QzYyLjUgNDEgNTkgNDAuNSA1NSA0MUM2MSAzMSA2OSAxNSA3NiA1WiIvPjxwYXRoIGQ9Ik00MCA0MCA0MyAzMSA0NiAzNiA0OSAyOCA1MiAzNSA1NSAyOSA1OCAzNiA2MCA0MFoiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0yNiAzNGg0OGExNiAxNiAwIDAgMSAxNiAxNnYxOGExNiAxNiAwIDAgMS0xNiAxNkg0NmwtMTYgMTRWODRoLTRhMTYgMTYgMCAwIDEtMTYtMTZWNTBhMTYgMTYgMCAwIDEgMTYtMTZaTTM0LjUgNThhNS41IDUuNSAwIDEgMCAxMSAwYTUuNSA1LjUgMCAxIDAtMTEgMFpNNTYuNSA1OGE1LjUgNS41IDAgMSAwIDExIDBhNS41IDUuNSAwIDEgMC0xMSAwWiIvPjwvc3ZnPgo='; /** @param callable(): void $chatRenderer */ public function __construct(private SettingsPage $settings, private $chatRenderer, private Access $access) {} /** * The capability that shows the menu and the chat screen, and the drawer on the other admin * screens and the block editor's sidebar (Admin\Drawer), which ask this rather than a question * of their own: it is the same chat under a different chrome. * * @since 0.6.0 */ public static function capability(Access $access): string { /** * Filters the capability that shows the Alpaca Bot menu, its chat screen, the chat * drawer on the other admin screens and the chat sidebar in the block editor * (Admin\Drawer). Filtered apart from the REST routes' * `alpaca_bot/capability/chat`, so a site can open the screen to a role and not the API, or * the reverse. Only a non-empty, non-numeric string is honoured (Capability::filtered()): * `true`, `__return_true` or a number would turn the check into a legacy user level, so * they are ignored and the Chat row stands. * * @since 0.5.0 * @param string $capability the Chat row of Settings › Access, `edit_posts` by default */ return Capability::filtered('alpaca_bot/admin/menu_capability', $access->stored('chat')); } public function register(): void { $cap = self::capability($this->access); add_menu_page(__('Alpaca Bot', 'alpaca-bot'), __('Alpaca Bot', 'alpaca-bot'), $cap, self::SLUG, $this->chatRenderer, self::ICON, 3); add_submenu_page(self::SLUG, __('Chat', 'alpaca-bot'), __('Chat', 'alpaca-bot'), $cap, self::SLUG, $this->chatRenderer); add_submenu_page(self::SLUG, __('Alpaca Bot Settings', 'alpaca-bot'), __('Settings', 'alpaca-bot'), 'manage_options', SettingsPage::SLUG, [$this->settings, 'render']); } }