| @@ -1,17 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Desktop Mode — Accent color swatches. | |
| 3 | + * OpenStation — Accent color swatches. | |
| 4 | 4 | * |
| 5 | 5 | * The OS Settings panel lets users pick an accent color that the shell |
| 6 | 6 | * applies to `--wp-admin-theme-color` on the parent frame. Themes and |
| 7 | 7 | * plugins can extend or restrict the swatch list via the |
| 8 | - * {@see 'desktop_mode_accent_colors'} filter — e.g. a brand theme that | |
| 8 | + * {@see 'openstation_accent_colors'} filter — e.g. a brand theme that | |
| 9 | 9 | * injects its corporate palette, or a compliance plugin that collapses |
| 10 | 10 | * the list to a single approved value. |
| 11 | 11 | * |
| 12 | - * @package WPDesktopMode | |
| 13 | - * @since 0.5.0 | |
| 12 | + * @package OpenStation | |
| 14 | 13 | */ |
| 15 | 14 | |
| 16 | 15 | defined( 'ABSPATH' ) || exit; |
| 17 | 16 | |
| @@ -24,24 +23,78 @@ | ||
| 24 | 23 | * - `label` is the human-readable name used in the picker tooltip. |
| 25 | 24 | * - `value` is a hex color applied to `--wp-admin-theme-color`. |
| 26 | 25 | * |
| 27 | 26 | * The defaults ship with six WordPress-adjacent swatches. Consumers |
| 28 | - * mutate the list via the `desktop_mode_accent_colors` filter — entries | |
| 27 | + * mutate the list via the `openstation_accent_colors` filter — entries | |
| 29 | 28 | * whose `value` fails `sanitize_hex_color()` are dropped silently so a |
| 30 | 29 | * bad filter return can't inject arbitrary CSS into the shell. |
| 31 | 30 | * |
| 32 | - * @since 0.5.0 | |
| 33 | - * | |
| 34 | 31 | * @return array<int, array{id: string, label: string, value: string}> |
| 35 | 32 | */ |
| 36 | -function desktop_mode_get_accent_colors() { | |
| 33 | +function openstation_get_accent_colors() { | |
| 37 | 34 | $defaults = array( |
| 38 | - array( 'id' => 'wp-blue', 'label' => __( 'WordPress Blue', 'desktop-mode' ), 'value' => '#2271b1' ), | |
| 39 | - array( 'id' => 'indigo', 'label' => __( 'Indigo', 'desktop-mode' ), 'value' => '#3858e9' ), | |
| 40 | - array( 'id' => 'teal', 'label' => __( 'Teal', 'desktop-mode' ), 'value' => '#04a4cc' ), | |
| 41 | - array( 'id' => 'emerald', 'label' => __( 'Emerald', 'desktop-mode' ), 'value' => '#059669' ), | |
| 42 | - array( 'id' => 'amber', 'label' => __( 'Amber', 'desktop-mode' ), 'value' => '#d97706' ), | |
| 43 | - array( 'id' => 'rose', 'label' => __( 'Rose', 'desktop-mode' ), 'value' => '#e11d48' ), | |
| 35 | + // The brand accents lead the list: Pulse is the identity | |
| 36 | + // colour and the shipped default, Nebula its softer twin. | |
| 37 | + array( | |
| 38 | + 'id' => 'pulse', | |
| 39 | + 'label' => __( 'Pulse', 'desktop-mode' ), | |
| 40 | + 'value' => '#f252fc', | |
| 41 | + ), | |
| 42 | + array( | |
| 43 | + 'id' => 'nebula', | |
| 44 | + 'label' => __( 'Nebula', 'desktop-mode' ), | |
| 45 | + 'value' => '#ec9bff', | |
| 46 | + ), | |
| 47 | + // The other brand accents. Sirius is the cool counterweight to | |
| 48 | + // Pulse; Lagoon sits between the two families and is what the | |
| 49 | + // guide reaches for when Pulse is too loud and WordPress Blue | |
| 50 | + // too corporate; Starlight is the brand's light, for a station | |
| 51 | + // with no colour at all. | |
| 52 | + array( | |
| 53 | + 'id' => 'sirius', | |
| 54 | + 'label' => __( 'Sirius', 'desktop-mode' ), | |
| 55 | + 'value' => '#9af2ff', | |
| 56 | + ), | |
| 57 | + array( | |
| 58 | + 'id' => 'lagoon', | |
| 59 | + 'label' => __( 'Lagoon', 'desktop-mode' ), | |
| 60 | + 'value' => '#9f98ff', | |
| 61 | + ), | |
| 62 | + array( | |
| 63 | + 'id' => 'starlight', | |
| 64 | + 'label' => __( 'Starlight', 'desktop-mode' ), | |
| 65 | + 'value' => '#fffbff', | |
| 66 | + ), | |
| 67 | + array( | |
| 68 | + 'id' => 'wp-blue', | |
| 69 | + 'label' => __( 'WordPress Blue', 'desktop-mode' ), | |
| 70 | + 'value' => '#2271b1', | |
| 71 | + ), | |
| 72 | + array( | |
| 73 | + 'id' => 'indigo', | |
| 74 | + 'label' => __( 'Indigo', 'desktop-mode' ), | |
| 75 | + 'value' => '#3858e9', | |
| 76 | + ), | |
| 77 | + array( | |
| 78 | + 'id' => 'teal', | |
| 79 | + 'label' => __( 'Teal', 'desktop-mode' ), | |
| 80 | + 'value' => '#04a4cc', | |
| 81 | + ), | |
| 82 | + array( | |
| 83 | + 'id' => 'emerald', | |
| 84 | + 'label' => __( 'Emerald', 'desktop-mode' ), | |
| 85 | + 'value' => '#059669', | |
| 86 | + ), | |
| 87 | + array( | |
| 88 | + 'id' => 'amber', | |
| 89 | + 'label' => __( 'Amber', 'desktop-mode' ), | |
| 90 | + 'value' => '#d97706', | |
| 91 | + ), | |
| 92 | + array( | |
| 93 | + 'id' => 'rose', | |
| 94 | + 'label' => __( 'Rose', 'desktop-mode' ), | |
| 95 | + 'value' => '#e11d48', | |
| 96 | + ), | |
| 44 | 97 | ); |
| 45 | 98 | |
| 46 | 99 | /** |
| 47 | 100 | * Filters the list of accent-color swatches offered in OS Settings. |
| @@ -46,9 +99,9 @@ | ||
| 46 | 99 | /** |
| 47 | 100 | * Filters the list of accent-color swatches offered in OS Settings. |
| 48 | 101 | * |
| 49 | 102 | * ```php |
| 50 | - * add_filter( 'desktop_mode_accent_colors', function ( $colors ) { | |
| 103 | + * add_filter( 'openstation_accent_colors', function ( $colors ) { | |
| 51 | 104 | * $colors[] = array( |
| 52 | 105 | * 'id' => 'brand', |
| 53 | 106 | * 'label' => __( 'Brand', 'my-plugin' ), |
| 54 | 107 | * 'value' => '#ff00ff', |
| @@ -61,13 +114,11 @@ | ||
| 61 | 114 | * Individual entries missing an `id`, `label`, or whose `value` |
| 62 | 115 | * isn't a valid hex color are dropped — the shell can't render |
| 63 | 116 | * half-formed swatches safely. |
| 64 | 117 | * |
| 65 | - * @since 0.5.0 | |
| 66 | - * | |
| 67 | 118 | * @param array $defaults Built-in swatches. |
| 68 | 119 | */ |
| 69 | - $filtered = apply_filters( 'desktop_mode_accent_colors', $defaults ); | |
| 120 | + $filtered = apply_filters( 'openstation_accent_colors', $defaults ); | |
| 70 | 121 | if ( ! is_array( $filtered ) ) { |
| 71 | 122 | return $defaults; |
| 72 | 123 | } |
| 73 | 124 | |
| @@ -85,10 +136,10 @@ | ||
| 85 | 136 | } |
| 86 | 137 | if ( isset( $seen[ $id ] ) ) { |
| 87 | 138 | continue; |
| 88 | 139 | } |
| 89 | - $seen[ $id ] = true; | |
| 90 | - $clean[] = array( | |
| 140 | + $seen[ $id ] = true; | |
| 141 | + $clean[] = array( | |
| 91 | 142 | 'id' => $id, |
| 92 | 143 | 'label' => $label, |
| 93 | 144 | 'value' => $value, |
| 94 | 145 | ); |