# wx.setNavigationBarColor(Object object)

Start from base library version 1.4.0. Please remaining backward compatible.

with Promise style call: Supported

Need page permissions: Mini Programs cannot call this interface from a plugin page, and plugins cannot call the interface from the plugins page

Mini Program plugin: Support, need to Mini Program base library version no less than 2.1.0

When used in Mini Programs plug-ins, can only be called from the page of the current plug-in

Set the page navigation bar color

# parameter

# Object object

attribute type Default values Required Introductions
frontColor string yes Foreground color values, including the color of the on, title, and status bar, are supported only #ffffff and #000000
backgroundColor string yes Background color value, valid value is hexadecimal color
animation Object no Animation effect
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

object.animation Structure

attribute type Default values Required Introductions
duration number 0 no Animation change time, unit ms
timingFunc string 'linear' no Animation change mode

object.animation.timingFunc Legal value

value Introductions Minimum version
'linear' Animation moves at the same speed from start to finish.
'easeIn' Animation begins at low speed
'easeOut' Animation ends at low speed
'easeInOut' Animation starts and ends at low speeds

# sample code


wx.setNavigationBarColor({
  frontColor: '#ffffff',
  backgroundColor: '#ff0000',
  animation: {
    duration: 400,
    timingFunc: 'easeIn'
  }
})