Swiftui change sheet background color. So you can use it like any other View.

selected state and . From the docs: Use one of the values in ColorScheme with this modifier to set a preferred color scheme for the nearest enclosing presentation, like a popover, a sheet, or a window. Alternatively, you could use SwiftUI-Introspect to customise a single one by doing something like: Oct 13, 2022 · To change a tab bar background color in SwiftUI, you apply toolbarBackground modifier to the child view of TabView. Those two pieces of code might look similar, but they yield different results because the order in which you apply modifiers matters. e. background(. ///. A color used as a view expands to fill all the space it’s given, as defined by the frame of the enclosing ZStack in the above example: SwiftUI only resolves a color to a concrete value just before using it in a given environment. It should look like a watermark for the screen. 4 applying . It should be the first child of the ZStack to act as the background. presentationBackground(. isEnabled) var isEnabled let backgroundColor: Color func body (content: Content) -> some View Jul 25, 2023 · Customize SwiftUI VStack Background. 5)) } This results in most of the Form fully styled: Oct 2, 2023 · In this blog post, we’ll explore how to set a transparent background for a sheet in SwiftUI using the . clear) Thanks. struct ClearBackgroundView: UIViewRepresentable {. For example, the following code changes the background color of a list to blue: List (/* items */) { item in. Jan 15, 2024 · 2. self) { intervals in. This means that if you had a view that you wanted to show in a sheet 9. white. Pretty easy to implement, right? P resenting on change of the object value Discussion. Utilize one of the available libraries to implement a Aug 2, 2023 · Step 2: Add a Colored Shape to ZStack. backgroundColor = UIColor. red. Mar 6, 2020 · I saw this question but it doesn't work in SwiftUI. ZStack(alignment: . <2> Add background color to the frame view. //if login. It always takes default form backgroundcolor depending on which color scheme is selected in the iPhone settings. var onColor = Color(UIColor. I also showed how you could pass in another parameter ( isSelected ) because in your original example it looked like you may want to do things conditionally based on that as well. Using . The background image should cover the complete view. red) . I want that in AddTodoView using the ColorPicker I select a color, and in the ContentView this color is displayed in the background. foregroundColor(. Or, if you want to apply it to every row in the Form, wrap everything in a Group and apply the modifier to it: Form {. 2. none. background(Color(UIColor. background(AddTodoView(). . Rather, you define how the presentation looks and the condition under which SwiftUI should present Nov 6, 2019 · 6. If you want to make a transparent background just for one sheet: @State private var isPresented = false. ignoresSafeArea() Text("Using ZStack") The Mar 6, 2021 · If someone's looking to color whole safe area or just parts of it, there's a simple solution: struct ContentView: View {. Longer answer: you can create a custom GroupBoxStyle (see example) which will allow you to change the background but at the cost of having to then manually layout the contents (which somewhat defeats the purpose). To use the modifier, provide it with a set of the sizes you want to support, like this: struct ContentView Jun 10, 2020 · If you set the background color to white because that's the default background color, and you want the system to be able to update it when the user switches to dark mode, change . medium, . PickerRow(text: intervals) this solution was tested and verified on macOS. The background() modifier is your go-to function for this purpose. I would use a Bool instead, to indicate whether to use the background style. Specifies the preferred visibility of backgrounds on a bar managed by SwiftUI. It should be out like this: TextField("Title", text: . There are two steps to change the SwiftUI list background color. Ho Oct 28, 2019 · iOS 13. SwiftUI’s presentationDetents() modifier lets us create sheets that slide up from the bottom of our view, but occupy only part of the screen – how much is down to us, and we have as much or as little control as we want. You can use . The `. This is the key part. all) . opacity(0. blue, lineWidth: 1) For the appearance, you can see that the button has an orange background, some corner radius and a foreground color of white over some padding. And then edit the background color when the navigationLink is selected. Aug 31, 2019 · selectedSegmentTintColor is available since beta 3 for changing the color of the selected segment. pdf ), set up Image Set → Render as → Template Image. For example, this removes the default background for a list and replaces with an indigo color: List(0. Short answer: it is currently not properly supported by SwiftUI : (. indexViewStyle(. listRowBackground(Color(. Jul 12, 2022 · 1. tint(. With NavigationView, it was simply a matter of embedding in a ZStack with the background view called before the NavigationView (as described in an older post: How change background color if using NavigationView in SwiftUI? Sep 15, 2021 · I tried something similar to this solution: Modifying Toolbar, but it does not allow me to change the color of the navigation bar. We will set navigationTitle and navigationBarTitleDisplayMode for the view as well. All solution I found here to set the UITableView. My code basically looks like this with some stuff removed for readability: var body: some View {. Jun 28, 2020 · By setting the value of showSettingsView you can decide whether to show or hide SettingsView. Jul 21, 2021 · Change UIView background color in SwiftUI. strokeBorder(Color. You can use UITableView. ProgressView(value: summary. var body: some View {. Let’s get started by creating a simple view. I am not sure about how to change the background color of the ScrollView. greenComponent() Instead, you need to check variable g (the variable you used to create the color): let green = g. I haven't seen many problems with putting a UIViewRepresentable on top of it. sRGB, red: 0, green: 1, blue: 1, opacity: 0. red for example to set the Form 's background color to red. So you can use it like any other View. Is it possible to change the background color from secondary to another color or image? If yes, how would I do that? This is my code: Jul 7, 2019 · So the best answer I've seen for now that actually changes the underlying background color of the NavigationView (in OP's original question) is just setting the background color on the UIView appearance, as eluded to in this answer: UIView. You can use AnyShapeStyle to erase the types, converting both Color and BackgroundStyle to AnyShapeStyle. yellow) By applying a background material type, you can create a blur effect to the sheet. If item changes, the system dismisses the sheet and replaces it with a new one using the same process. presentationDetents([. In case you need to set up accent color for entire app with SwiftUI interface, you just need to define AccentColor in Assets. black) edited Feb 15 at 9:25. The background color fill the entire space. However, for custom button colors during Mar 5, 2023 · Text(text) . }. buttonStyle() modifier. white) to . When it’s bigger than the content of the popover, it will fill the arrow. backgroundColor = . foregroundColor(Color. } } And use it like MyColor. All other view types will not be used and simply be ignored. Jun 8, 2019 · 25. In the code: Or: You can add the "Template" suffix and set "Rednder as default". Color("yellow") 1. Starting from iOS 15, SwiftUI introduced the tint modifier, which enables changing the cursor color in a text field. accentColor but they don't change the texts' color. static let gtSystemBG = Color("GTSystemBackground") /// Color static let systemGroupedBackground = Color(UIColor. pickerStyle(SegmentedPickerStyle()) . circle") } In the above example, I am using Label, but you can also use a Text or Image view. Earlier, we Dec 26, 2023 · To change the background color of a SwiftUI List in iOS 15, you can use the `. tag(2) . We'll call it SplashShape. return . I will also give you examples of how to change section headers and footers. // all the controls go here, just as before. Jun 16, 2023 · And this adds system default padding then sets a red background color and a white foreground: Text("Hacking with Swift") . allCases @State private var selectedItem: ColorEnum = ColorEnum. white) Download this as an Xcode project. Color is conformed to View. To draw attention to an important, narrowly scoped task, you display a modal presentation, like an alert, popover, sheet, or confirmation dialog. I believe you can do it by making your FormView background transparent, rather than the newer . presentationBackground (_ style: S) with colours and blurs ( material types ). blue]), startPoint: . background(LinearGradient(gradient: Gradient(colors: [Color. So it will be like: UISegmentedControl. large]) . white) but that doesn't do anything. I wrote this so far : Text("TAP ME") . background. struct ContentView: View {. Apr 1, 2020 · It makes the background of the sheet transparent while allowing the content to be sized as needed to appear as if it's the only part of the sheet. For changing the textColor, you should use setTitleTextAttributes for . For example: ZStack { . I deleted the Textfieldstyle and the behavior is still there. <100) { i in Text("Example \(i)") } . Feb 13, 2023 · In assets on import icon (import from *. open override var frame: CGRect {. tabBar) } } . You can use any color or even gradients May 21, 2021 · Making your own color in the assets folder will work, but Color(UIColor. Thanks. <#Your View#>. @State var showSettingsView = false. Group {. Text("Hello World!") Sep 16, 2019 · As other have mentioned, changing the UITableView background will affect all other lists in your app. all) // <- optionally, if you want to cover the whole screen. Jul 1, 2020 · This has the advantage that you can use it on other Views, not just Buttons. // Or any other color you like to color safe area with. Because SwiftUI is a declarative framework, you don’t call a method at the moment you want to present the modal. background() changes the background of the progress view. 7 How to change a background color in whole App? 0 SwiftUI: background color for whole screen and not simple view? 3 Aug 17, 2021 · As soon as i click in the textfield, it shows a gray background. preferredColorScheme(. background(background. toolbarBackground accepts two parameters. ZStack { . foregroundStyle(. edgesIgnoringSafeArea to fill the area, but I'd prefer not to mess with that. This solution works for navigationBarTitleDisplayMode "large", but Mar 30, 2020 · It’s super easy to tell the layout engine to ignore the safe area by adding one modifier to our Color: Color . clear also don't work. Try the following: NavigationView {. I'm working with Xcode 11. Mar 25, 2021 · Inside CustomButtonStyle, I use a ternary expression to set the color of the background RoundedRectangle based on configuration. backgroundColor) Oct 9, 2020 · SwiftUI 3. Sep 9, 2023 · Text("Third"). Here’s an example to demonstrate how it’s done: Getting Started. systemBackground)) (umayanga's answer). indigo) Download this as an Xcode project Jul 29, 2019 · let mycolor = Color(red: r, green: g, b, opacity: o) There is nothing like this: let green = mycolor. clear //<<here clear. 0" they'll introduce things (my choices include replacements for UIImagePickerController & UIActivityViewController) but for now this is what we're stuck with. leading, endPoint: . I took a slightly different approach; I wanted to change only the title text color, and nothing else about the NavigationBar. answered Aug 20, 2019 at 17:48. Oct 9, 2020 · 3. Button(action: {. How can I make the entire background white? Aug 1, 2019 · Is there a way I can specify the background color of the view used to display a sheet in SwiftUI? I know I can set . cornerRadius(10). Do any of you have a solution? A material isn’t a view, but adding a material is like inserting a translucent layer between the modified view and its background: The blurring effect provided by the material isn’t simple opacity. dark) // white tint on status bar. 2, green: 0. static let ui = Color. ToolbarPlacement: The bars to place the style in. original) only works on Image views. Discussion. background modifier in SwiftUI like this. systemGray5) var thumbColor = Color. TabBar icons will get it without any additional code. /// These could be anywhere before the list has loaded. I am learning SwiftUI, I want change navigation Title Color. 0). The key to our background color changing magic is going to be creating our own custom SwiftUI Shape struct. So I need to change it - here is the final code and result: Sep 4, 2020 · From iOS 16. Button("Open Popover") {. 3. Works in macOS as requested, but apparently not in iOS. 4 it should be possible to use . @State private var progress: Double = 0. sheet background transparent. Trust me, my background is OOP and not Reactive, and what Apple introduced is a serious paradigm change. extension View {. I believe this will change the color scheme entirely, not just the status Apr 11, 2020 · If you change the brightness and/or saturation of the tinting color, you'll get different results. In this article, we will look at changing background color for NavigationStack in SwiftUI. page(backgroundDisplayMode: . Mar 29, 2022 · 1. background(Color(red: 0. scrollContentBackground. padding() . background on my view, but on iPhone X that doesn't affect the safe area. Is there a way to apply a background to the sheet itself? Dec 1, 2022 · New in iOS 16. We can add background color with presentationBackground Sep 6, 2019 · 2. system(size: 48)) . The sheet has a binding bool of presentAnotherView and the content of the sheet is AnotherView(). You can define a color using RGB values as follows: VStack {. Based on my extensive research, it seems impossible (without going deep into UIKit) to change the background color of your sheets. background ()` modifier. popoverVisible = true. 3 Set background color to pink with . Use presentation modifiers to show different kinds of modal presentations, like alerts, popovers, sheets, and confirmation dialogs. red, Color. Dec 14, 2023 · 1. isLoggedIn {. With just a few lines of code, you can make When item is non- nil, the system passes the item’s content to the modifier’s closure. Using ToggleStyle. blue view will be displayed behind the Text view, acting as a background. I want to share an alternative way to define dynamic colors in Asset catalog, but no need to write tedious code like. Jun 30, 2019 · 37. edgesIgnoringSafeArea(. forgroundColor and . systemRed. gtSystemBG) /// Type 'UIColor' has no member 'gtSystemBG' I would like to create a button with a rounded rectangle view with a border, and a background color. constant("text")) . This is the function we'll be using to create the various animations. . Customizing the Background of SwiftUI Bottom Sheet. red) This covers the whole view in the background color, which is the behavior I want, but the Text is now also ignoring the safe zones. Feb 1, 2023 · In this blog post, I will show you how to customize the SwiftUI List style: hide separators, change separator colors, adjust the list background color, and the background color of individual cells. fullScreenCover Feb 22, 2023 · I'm not able to change the background color of a Form in SwiftUI for iOS < 16. init) ?? AnyShapeStyle(Color. Nikolay Suvandzhiev. On visionOS, the default glass window background can only be created using glassBackgroundEffect. The issue with your code is you add cornerRadius inside the background modifier. so you need to change the background color of the tableView. onDismiss. SwiftUI allows you to create custom colors if the predefined ones do not fit your needs. selectedSegmentTintColor = . I want to change the color for page indices and background. It shows the active index using white color, and inactive indices using gray color with a light gray background if backgroundDisplayMode is set to always like this: . 4 Set corner radius with . edited Mar 7, 2022 at 16:00. always)). However, there is a simple workaround: Create a custom view with the desired background color and remember to apply the . map(AnyShapeStyle. This enables a context-dependent appearance for system defined colors, or those that you load from an Asset Catalog. We have to modify our layout to occupy the whole space. So I will use @atineoSE answer. systemBackground. blue) RoundedRectangle(cornerRadius: 50, style: . SwiftUI provides built-in button styles like DefaultButtonStyle, PlainButtonStyle, and BorderlessButtonStyle. By default, SwiftUI sheets come with a standard background color, usually white or a system background color, depending on the device’s appearance settings (light or dark mode). In order to set a background color, we can add a Color view. appearance(). 3) . Nov 29, 2019 · I am new to SwiftUI. Aug 25, 2023 · In iOS 16. To change the color, you can use the . VStack {. This implementation reduces the opacity of the button background color so no need for a new style to be injected. I know it sounds odd, but that's how the framework has been designed. I want to design a custom view with few controls and a background image. 5. Example. The closure to execute when dismissing the sheet Jul 12, 2022 · 1. @State var popoverVisible = false. ignoresSafeArea() // 1*. presentationBackground modifier. Jun 18, 2023 · With the release of iOS 16. /// - Parameter color: Color the title should be. Oct 11, 2020 · 28. pink). MainView() //} else {. Result. Around the PDF file is the color gray with light theme and black with dark theme. To change the button's color when pressed, we can utilize the . visible, for: . Set a new background color. ProgressView(value: progress, total: 1. @State private var isLoading = false. page). The value that you set overrides the user’s Dark Mode selection for that presentation. For example, this creates a text view with a large font, then places a 100x100 image behind it: Text("Hacking with Swift") . Use the background modifier to change the button's background color. Instead you can use a ZStack and add a background below your VStack. Dec 5, 2022 · This ought to be straightforward enough, but I cannot find out how to place a background behind a NavigationStack. UI() Oct 25, 2020 · How to change Background Color of a View containing a List back to White in SwiftUI. ContentView . Apr 30, 2024 · SwiftUI doesn’t have a dedicated modifier for displaying background colors or images, but instead lets us specify any kind of background view using its background() modifier. normal state (unselected). Sep 29, 2019 · @SzymonW, glad to help. ZStack {. Shape structs utilize the function path(in rect: CGRect) -> Path to define what they look like. tabItem { Label("Tab 2", systemImage: "2. Feb 28, 2023 · 1. background(Color. 8, blue: 0. hidden) . Apr 19, 2021 · Text("Hello, SwiftUI!") <1> Create a flexible frame that occupied the whole space. trailing)) Changing the background color of a SwiftUI Segmented Picker is a simple yet effective way to enhance your app’s UI. From the documentation: Allows views behind the presentation to show through translucent styles. Using the above and this as inspiration, I landed on: import SwiftUI. ratio) . Maybe - maybe - next year with "SwiftUI 2. Text (item. But realize that set the UITabBar. I also could use . background ()` modifier takes a `Color` value as its argument. Is there a better way to have a background cover the entire view without sacrificing the safe zone coverage for the inner content? On macOS, this has a unique appearance compared to the default ShapeStyle. May 1, 2024 · 1. func makeUIView(context: Context) -> some UIView {. Aug 8, 2020 · 8. You cannot modify it directly systemBackground because it is declared as a read-only class property. In SwiftUI, you create a modal presentation using a view modifier that defines how the presentation looks and the condition under which SwiftUI presents it. top) {. 2 Set text color to white with . edited Sep 28, 2022 at 15:24. struct ColoredToggleStyle: ToggleStyle {. In documentation. Load 7 more related Jun 23, 2022 · I'm building an app that displays PDF files with SwiftUI and PDFkit. Default Sheet Background. white). Wrap your conditions inside the withAnimation {} will automatically apply animation to all the related Views to these conditions/data. Hide the standard background of the List. backgroundColor = . I tried . Since the release of iOS 16, it's easy to create an interactive bottom sheet using SwiftUI. 0 Change background color of SwiftUI List View. selectionStyle = . light) // black tint on status bar. Here, we set it to red. answered May 21, 2022 at 16:22. I can only modify a sheet's content background. 1. May 13, 2023 · Here’s an example of how to add a background color to a SwiftUI view using the ZStack view: var body: some View {. Text("This is a ZStack") } The Color. gray)) The optional here makes this a bit messy. 15. 0. teal. green // <- or any other Color/Gradient/View you want. All you need to do is to embed a modifier called presentationDetents in a Sheet view. ignoresSafeArea (. Jul 15, 2023 · Basics: Set the Background Color. yellow) } } Jul 19, 2019 · 1. presentationBackground(Color. The other solution I tried was this: Creating navigationBarColor function, which is based on: NAVIGATIONVIEW DYNAMIC BACKGROUND COLOR IN SWIFTUI. Version 2. ScrollView {. This is the actual SwiftUI way. 0: import SwiftUI struct ContentView: View { var items: [ColorEnum] = ColorEnum. By the end of this tutorial, you will be able to describe SwiftUI lists Dec 31, 2020 · 1. Text("Hello") Text("SwiftUI") } . /// Sets the text color for a navigation bar title. Define your color in asset catalog as usual. Aug 1, 2021 · I am new to swiftUI, I have 2 views. Here is the sample code: May 2, 2021 · I have been told that I should change the background color of my ScrollView and set my view's background as clear. But since Color and UIColor values are slightly different, you can get rid of the UIColor. SwiftUI detects when the condition changes Jul 6, 2022 · In iOS 16, we finally got a native way to change the background color of a list view in SwiftUI. What if you decide to load your image using some libs or pods?! It is better to change the default button style to plain using the modifier below: Jun 1, 2021 · VStack { Text("Foo") } . // Use default background color based on light/dark mode. answered Jul 11, 2021 at 11:54. navigationBar, . May 28, 2023 · You can set the icon and text that is displayed for each tab with the tab item modifier: Text("Second View") . Change Cursor Color with SwiftUI. // Tint is B, or RGB background layer for compositing op // Image is A, or RGB foreground layer for compositing op Aug 23, 2020 · But the picker has that grayish tint around the date (See image below). renderingMode(. isPressed. didSet {. Jul 20, 2020 · The effect I am trying to get to is a blur effect that when a sheet is presented, its background is blurred and partly transparent. all) And there you go, full screen background color! Now just throw that Color into a ZStack as the first item and you can build everything else out on top of it. All SwiftUI's List s are backed by a UITableView in iOS. red) The tint modifier allows you to set a tint color to the ProgressView. 2. navigationTitle("Parent Login") I have tried to color of navigation title using below code. drawsBackground = true. Then we can use the background() modifier with a specific color to change the color of the sheet. With the new presentationBackground modifier, you can now change the background color of the sheet like this:. if the name of the image ends in "Template", use the image as a template, otherwise render it as the original image. 1 and catalina 10. scrollContentBackground(. Jul 24, 2019 · The navigationLink acts like Button and it gets the default button style with blue color. progressViewStyle modifier. Instead, it uses a platform-specific blending that produces an effect that resembles heavily frosted glass. This can go in the init of the view, however this affects every List and Form. sheet or . You can use this line to change the selection style in the init of the View. I just want the entire background to be white. It matches the default background of a window: a wallpaper-tinted light gray in the light appearance and a wallpaper-tinted dark gray in the dark appearance. You display this content in a sheet that you create that the system displays to the user. all) modifier. I created a new ToggleStyle to change the three colors of the Toggle (on color, off color, and the thumb). clear) makes the . We can do this with the new view modifier, . ShapeStyle: The style to display as the background of the bar. You can provide multiple placements to customize multiple bars at once, as in the following example: TabView { NavigationView { ContentView() . blue. init() {. gtSystemBG) won't (you defined gtSystemBG as a Color, not UIColor). standardAppearance will totally override my previous customization. import SwiftUI struct ContentView: View { // State variable to control the visibility of the sheet @State private var showSheet = false var body: some View { // Button to trigger the sheet presentation Button("Show Sheet") { // Toggle the Apr 1, 2020 · You can then set the frame modifier for the content as needed to fit the screen without the user having to know the modal is not custom sized. continuous) . g. green) var offColor = Color(UIColor. struct MyButtonModifier: ViewModifier { @Environment (\. UITableViewCell. However I can't change the sheet's background. white) . However if you want different background colors you can set the default to clear, and set the background color in swiftui views like so: List {. Using the AWESOME answer from @Asperi that I have been trying to find all day, I have built a simple view modifier that can now be applied inside a . italic() And use it with your picker code. presentationBackground. @Jordan I considered the sidenote also, but because i want to get used to swiftUi, i was looking only for SwiftUI solutions. With the help of extension, you can clear the default background Color of the NSTextView class and then use . I have just posted an answer for that issue on a similar question here. – Dec 29, 2022 · Here is an example where I tried to replicate a bordered prominent style with my custom label. Adding Interaction with Pressed Color. Works great on the iPad. In your NavigationView you have a VStack. I have set navigation Title using . Color. Applying a background color to a text view in SwiftUI is incredibly straightforward. This modifier behaves like background(_:in:fillStyle:), except that it always uses the background shape style to fill the specified shape. Background Color. In the end, we can add a background view to the screen, but at great costs. xcassets file like in the picture below. In your code, find a place to define your color as a variable, in my case it'll be something like this: extension Color {. override class var systemBackground: UIColor {. But it is declared as open though, so you can do something like: class MyColor: UIColor {. For changing the background color, I think the current method most people, and myself, are using is using a ZStack. Dec 15, 2023 · How to change navigation title color in swiftUI Hi, There. padding(50 Now the button will have a blue background color when displayed. Here’s a simple example: import SwiftUI struct ContentView: View { var body: some View { Text("Hello, SwiftUI!") . all) VStack {. 6)) In this example, the VStack has a custom color background created using Dec 10, 2021 · 1. Aug 16, 2023 · This blog post will guide you through the process of setting a custom cursor color in SwiftUI using a simple example. @State private var numberOfTaps = 0. blue @State private var backgroundColor: UIColor? Nov 23, 2022 · I have a TabView defined with . var label = "". appearance (). tint(Color) changes the current progress color while . title) } Sep 15, 2023 · Customize the Color. Use presentationBackground to set desired background for modals (fullScreenCover, sheet, popover). toolbarBackground( . self. accentColor. Dec 1, 2022 · At the time of writing, this works for List, TextEditor, and Form, so you can remove or change their background colors. Text("Item 1") Text("Item 2") Text("Item 3") } Jul 10, 2019 · But after that, I realize that I can't change the color of this line in the same way. Alternatively you can use a NavigationLink to push a new View on the navigation stack or use a sheet to present a view modally: struct ContentView: View {. 8,754 6 43 49. cornerRadius(5) answered Nov 6, 2019 at 10:14. For example, you can create a Path that outlines a trapezoid: Then you can use that shape as a background for a Label: Without the background modifier, the fill color shows through the label. font(. FormView() . Jul 16, 2019 · The first view in your hierarchy that uses this method will take precedence. scaleEffect(…) to make your background view take more space. Changing text color of datepicker I tried . 4, we can configure bottom sheets further with additional modifiers around presentationDetent. NavigationStack provides easiest way to add Navbar in SwiftUI apps. ForEach (numberOfIntervals, id: \. import SwiftUI. Make sure you apply toolbarBackground to a child view, not a TabView. headline) . bj yw zn wo iq kr pj tp ad bz