SwiftUI Widget Color Issue

Hello. I am creating a widget for my existing app. The main app uses a two color linear gradient throughout and I want the widget to do the same. Black at the top and my custom color of #06539F (ANCBlue). So, I create a custom color set in assets named ANCBlue with the above hex code. Then, I create an extension file:

"import SwiftUI

struct ColorManager {
static let ancBlue = Color("ANCBlue")
}"

I then put this line of code in my WidgetEntryView:

".background(LinearGradient(gradient: Gradient(colors: [.black, ColorManager.ancBlue]), startPoint: .top, endPoint: .bottom))"

This produces my gradient as black and green, not my wanted colors of black and ANCBlue. For the life of me, I cannot figure out why Xcode is changing the custom blue color (ANCBlue) into a green color. If I change the above line to just a solid background using my custom blue color, it shows just fine. Change it back to gradient with black and my custom blue, and the blue displays as green. Please help!

Replies

I have the same issue! I get a green with these colors, but if I use like .yellow .red it's totally fine. Even stranger still if I put it in a ContainerRelativeShape.fill(gradient) with rounded corners I can see the correct gradient around the edges and just a square green block in the center.
Code Block
var gradient: LinearGradient {
LinearGradient(
gradient: Gradient(
colors:
[
Color(red: 0.41, green: 0.63, blue: 0.77),
Color(red: 0.09, green: 0.35, blue: 0.52)
]),
startPoint: .top,
endPoint: .bottom)
}

Same Issue with Xode 13.2.1, blue appears as green when i use gradient