'Dark', 'light' => 'Light', 'minimal' => 'Minimal', 'tech' => 'Tech', 'brezn' => 'Brezn', ); /** * Returns all available themes (built-in + custom) as: * [ 'id' => ['name' => string, 'custom' => bool], ... ] * * @return array */ public static function discover(): array { $themes = array(); foreach ( self::BUILTIN as $id => $name ) { $themes[ $id ] = array( 'name' => $name, 'custom' => false, ); } $customs = get_option( 'breznflow_custom_themes', array() ); foreach ( $customs as $theme ) { $themes[ $theme['id'] ] = array( 'name' => $theme['name'], 'custom' => true, ); } return $themes; } /** * Returns all theme IDs as a flat array. * * @return string[] */ public static function get_theme_ids(): array { return array_keys( self::discover() ); } /** * Returns the URL to a built-in theme CSS file. * * @param string $id Built-in theme ID. * @return string */ public static function get_builtin_url( string $id ): string { return BREZNFLOW_URL . 'assets/themes/' . sanitize_key( $id ) . '.css'; } /** * Generates a CSS block for all custom themes, suitable for wp_add_inline_style(). * Tokens are mapped: token_name → --breznflow-token-name * * @return string CSS string (empty if no custom themes stored). */ public static function get_custom_theme_css(): string { $themes = get_option( 'breznflow_custom_themes', array() ); $css = ''; foreach ( $themes as $theme ) { $id = $theme['id']; $sel = '.breznflow-wrap[data-theme="' . $id . '"],' . '.breznflow-modal-overlay[data-theme="' . $id . '"],' . '.breznflow-fs-portal[data-theme="' . $id . '"]'; $css .= $sel . '{'; foreach ( $theme['tokens'] as $token => $value ) { $var = '--breznflow-' . str_replace( '_', '-', $token ); $css .= $var . ':' . $value . ';'; } $css .= '}'; } return $css; } }