<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Color Archives - AppMakers.Dev</title>
	<atom:link href="https://appmakers.dev/tag/color/feed/" rel="self" type="application/rss+xml" />
	<link>https://appmakers.dev/tag/color/</link>
	<description>SwiftUI Tutorials, iOS App Development, SwiftUI, Swift</description>
	<lastBuildDate>Mon, 09 Jun 2025 21:38:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://appmakers.dev/wp-content/uploads/2024/10/cropped-AppMakersDev-32x32.jpg</url>
	<title>Color Archives - AppMakers.Dev</title>
	<link>https://appmakers.dev/tag/color/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Color &#8211; SwiftUI</title>
		<link>https://appmakers.dev/color-swiftui/</link>
		
		<dc:creator><![CDATA[AppMakers]]></dc:creator>
		<pubDate>Mon, 02 Dec 2019 09:42:42 +0000</pubDate>
				<category><![CDATA[iOS Development]]></category>
		<category><![CDATA[SwiftUI]]></category>
		<category><![CDATA[SwiftUI Drawing and Animation]]></category>
		<category><![CDATA[Color]]></category>
		<guid isPermaLink="false">https://appmakers.dev/?p=1086</guid>

					<description><![CDATA[<p>Color in SwiftUI is an environment-dependent color. How to change the background color of the view in SwiftUI This will set the background of the Text to .red var body: some View { Text(&#34;Hello AppMakers.dev visitors&#34;) .background(Color.red) } If you want to set the whole screen to be red, you can do this. This will&#8230;</p>
<p>The post <a href="https://appmakers.dev/color-swiftui/">Color &#8211; SwiftUI</a> appeared first on <a href="https://appmakers.dev">AppMakers.Dev</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Color in SwiftUI is an environment-dependent color.</p>
<h2>How to change the background color of the view in SwiftUI</h2>
<p>This will set the background of the Text to .red</p>
<pre><code class="language-swift" data-line="">var body: some View {
    Text(&quot;Hello AppMakers.dev visitors&quot;)
        .background(Color.red)
}</code></pre>
<p>If you want to set the whole screen to be red, you can do this. This will center the text and set the whole view to red.</p>
<pre><code class="language-swift" data-line="">var body: some View {
    HStack {
        Spacer()
        VStack {
            Spacer()
            Text(&quot;Hello AppMakers.dev&quot;)
            Spacer()
        }
        Spacer()
    }
    .background(Color.red)
}</code></pre>
<p>Or use this instead to fill the whole view with red, ignoring the safe area.</p>
<pre><code class="language-swift" data-line="">var body: some View {
    ZStack {
        Color.red
            .edgesIgnoringSafeArea(.all)
        Text(&quot;Hello AppMakers.Dev&quot;)
    }
}</code></pre>
<h2>How to change Text Color in SwiftUI</h2>
<p>This code will change the text color to green. Use `foregroundColor(_:)` to set the color that the view uses for foreground elements.</p>
<pre><code class="language-swift" data-line="">var body: some View {
    Text(&quot;Hello&quot;)
        .foregroundColor(Color.green)
}</code></pre>
<h2>How to convert UIColor to SwiftUI Color</h2>
<p>To convert UIColor to SwiftUI Color, add this extension to your codebase.</p>
<pre><code class="language-swift" data-line="">extension UIColor {
    var suColor: Color { Color(self) }
}</code></pre>
<p>After that, you can call `.suColor` on any `UIColor` instance to get a SwiftUI Color.</p>
<pre><code class="language-swift" data-line="">someUIColor.suColor</code></pre>
<h2>How to use Color set from Assets Catalog?</h2>
<p>If you&#8217;ve created a color named &#8220;newColor&#8221; in your Assets catalog, you can use it like this:</p>
<pre><code class="language-swift" data-line="">Color(&quot;newColor&quot;)</code></pre>
<p>To simplify usage of Asset Catalog colors, add this extension:</p>
<pre><code class="language-swift" data-line="">extension Color {
    static let newColor = Color(&quot;newColor&quot;)
    static let newColor2 = Color(&quot;newColor2&quot;)
}</code></pre>
<p>Learn more about SwiftUI using <a href="https://appmakers.dev/swiftui-tutorials/">SwiftUI Tutorials</a> by AppMakers. You can always check the official documentation if updates occur.</p>
<p><a href="https://developer.apple.com/documentation/swiftui/color" target="_blank" rel="noopener noreferrer">Color Documentation</a></p>
<p>The post <a href="https://appmakers.dev/color-swiftui/">Color &#8211; SwiftUI</a> appeared first on <a href="https://appmakers.dev">AppMakers.Dev</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
