跳过内容

开始使用

终端窗口
bun add @capgo/capacitor-navigation-bar
bunx cap sync
import { NavigationBar } from '@capgo/capacitor-navigation-bar';

setNavigationBarColor

设置导航栏颜色

设置导航栏颜色和按钮主题。

import { NavigationBar } from '@capgo/capacitor-navigation-bar';
// Set to white with dark buttons
await NavigationBar.setNavigationBarColor({
color: NavigationBarColor.WHITE,
darkButtons: true
});
// Set to custom color
await NavigationBar.setNavigationBarColor({
color: '#FF5733',
darkButtons: false
});
// Set a custom divider color on Android 9+
await NavigationBar.setNavigationBarColor({
color: NavigationBarColor.WHITE,
darkButtons: true,
dividerColor: '#D9D9D9'
});

getNavigationBarColor

标题:获取导航栏颜色

获取当前导航栏颜色和按钮主题。

import { NavigationBar } from '@capgo/capacitor-navigation-bar';
const { color, darkButtons } = await NavigationBar.getNavigationBarColor();
console.log('Current color:', color);
console.log('Using dark buttons:', darkButtons);
标题:导航栏颜色

预定义导航栏颜色。

export enum NavigationBarColor {
/** White color */
WHITE = '#FFFFFF',
/** Black color */
BLACK = '#000000',
/** Transparent color */
TRANSPARENT = 'transparent',
}

本页面由插件生成 src/definitions.ts当上游的公共API发生变化时,请重新同步。