projection neo
projection neo

Reputation: 13

Using custom color as background did not work

Custom color in asset folder so I could use with things like foregroundColor background and other.

I give this color name

 "CL1"

Example foregroundColor(Color("CL1")) background(Color("CL1"))

My problem right now I can't use this as background because i tried and its not working. Also no error alert.

Color("Cl1").ignoresSafeArea() //background

When apply with text it work.

Text("test").foregroundColor(Color("CL1"))

my proof

Upvotes: 1

Views: 212

Answers (1)

Asperi
Asperi

Reputation: 257493

Try with ZStack

ZStack {
  Color("CL1").ignoresSafeArea()
  Text("test")
}

Upvotes: 1

Related Questions