Questions tagged [uicolor]

A UIColor object represents color and sometimes opacity (alpha value). You can use UIColor objects to store color data, and during drawing you can use them to set the current fill and stroke colors.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Swift Get color at point in CAGradientLayer [duplicate]

I am trying to get the colour of a point along a CAGradientLayer, the function I am using below works on a view with a solid background colour, but when using on a gradient, it returns the incorrect ...
  • 6,165
0 votes
0 answers
42 views

Getting the dark mode color for unit testing in Swift Package from a Color(UIColor) object when loaded from asset catalog

I am creating a standards library (Swift Package) that has strict requirements around the colors used in client applications. The colors are set up in an asset catalog and then referenced at runtime ...
0 votes
0 answers
25 views

Issues with background color changes - Swift [duplicate]

I'm having issues with buttons color changes in a project I'm working on. I use asset custom colors with values set for Any and Dark for my buttons. I use asset custom colors with values set for Any ...
0 votes
1 answer
146 views

How to use dark mode color in light mode of SwiftUI App?

I'm writing an app in SwiftUI, and have no trouble with normal UI. However, when a view's background is opposite to the app background color (e.g. use picture background), I need exactly what that ...
-1 votes
2 answers
166 views

How to change UIColor according to UserInterfaceStyle(Dark Mode/Light Mode) in UIView extension in swift [5+]? [duplicate]

I was creating the method in UIView extension and I needed to change UIColor according to UIUserInterfaceStyle i.e. separate UIColor for both Dark & Light mode Interface. Usually, in ...
  • 1,029
0 votes
0 answers
35 views

Read UIColor value from a function

I have a func to retrieve the RGB of an image. In the playground, the function return value as an array [r 0.0 g 0.459 b 0.761 a 1.0] import Foundation func findColors(_ image: UIImage) -> [...
  • 1
-1 votes
1 answer
56 views

Change color of branch status when adding and committing

This is my first time posting, so please go easy on me if I'm making any mistakes. ;) Currently when I use Git, the color of the branch is always Cyan. I was watching a video on how to use Git, and ...
0 votes
1 answer
17 views

Force function to pick a dark shade from image instaed of Light One

I have created this function to pick color from image. fun getMainColor(img: Bitmap): Int { val newImg = Bitmap.createScaledBitmap(img, 1, 1, true) val color = newImg.getPixel(0, 0) ...
0 votes
1 answer
46 views

Change color of SF Symbols icons

I have a MenuModel struc used to have a list of icons into a table as a menu: var menu: [MenuModel] = [SideMenuModel(icon: (UIImage(systemName: "house.fill")?.withTintColor(.systemRed))!, ...
  • 982
0 votes
2 answers
244 views

Convert Display P3 to eSRGB by hex color in iOS swift?

I'm using UIColorPickerViewController. When I use Sliders section, default value is display p3 like below an image. My app is using UIExtendedSRGBColorSpace. So I need to convert to ...
0 votes
0 answers
36 views

how to draw a gradient in iOS swift

{what is required} I am trying to draw a gradient similar to the attached images in iOS swift 4.0. below is the code I am trying to building this, but extension UIView { func setMenuCellGradient()...
0 votes
0 answers
15 views

how to draw dual tone gradient arround a UIView in iOS swift 4.0

How to draw a gradient colour around the UIview in dual colour tone (white and black). I have tried the below code. let gradient = CAGradientLayer() gradient.frame = CGRect(origin: ...
0 votes
0 answers
51 views

Overriding Storyboard custom colours

I have default custom colours in an xcassets file. I then retrieve an updated set of colours from a server. I override UIColor(named:) to use the updated colours in place of my default set. This works ...
0 votes
0 answers
32 views

Navigation Bar color won't change, despite being selected in the Bar Tint

I am using Xcode 14 and despite changing the navigation bar color to a color, it still morphs with the table view color. On my attributes inspector I have the bar tint as the color I want. I tried ...
1 vote
1 answer
39 views

Cannot extend UIColor

I tried the steps below to expeand UIColor, but it didn't work. At first, I added new color set in xcassets, and then add UIColor + Extension.swift in my project folder. // UIColor + Extension.swift ...
  • 185
3 votes
1 answer
103 views

Fill color affects shadow in SwiftUI

I have a SwiftUI view that applies a fill and shadow to a shape like this: struct ShadowRectangle: View { let color: UIColor var body: some View { Rectangle() .fill(Color(...
0 votes
1 answer
126 views

flutter change the color of utils const color , in the app screen using button

I wrote a big software, I tried to use 2 main colors for the whole software. I want to change the overall color of the software by pressing a button. I need your help. on the lib/utils: SO:they are ...
0 votes
2 answers
317 views

How to generate Material Design Color set of selected color programmatically?

Question 1. Let's assume the selected color is #a85c40. Now, how can we generate the Material color with some nearby shade from that picked color. The nearby material shade will be like shade 800. ...
  • 6,076
0 votes
0 answers
87 views

Can't find hex field for type="color" on Firefox and Safari

I want to use the to give the user a nice UI for color picking but I also want them to have the ability to input the exact hex code also. I see one for Chrome but can't find anywhere that's not a ...
  • 401
-1 votes
1 answer
173 views

How to replace the color of a pixel in an image?

I have a function that can return the color of a pixel by points extension CGImage { func colors(at: CGPoint) -> UIColor { let colorSpace = CGColorSpaceCreateDeviceRGB() let bytesPerPixel = ...
0 votes
1 answer
212 views

Hex color code with opacity is not working as expected in iOS

I am programmatically setting the hex color with alpha but result is not looking as expected. Example: hex color #478295 with opacity 50% which is #80478295 and I am using ` public convenience init?(...
  • 1,145
0 votes
1 answer
97 views

Label color of disabled SwiftUI buttons

What are the label colors of these disabled SwiftUI buttons? I would like to use the colors in my own button styles so that they are consistent with the existing styles. I found that they have some ...
  • 903
0 votes
1 answer
46 views

I am using UIColour for colour line but its not give me properly result ... so i want know how to fix it

here , this is my code , When i am click on colorChange the it should be give for color choosen . After the colour choosen the selected colour must be display but it wont gave which colour i choose it ...
1 vote
0 answers
446 views

Could not build Objective-C module 'UIKit'

Everything was working fine and now all of a sudden I get this error message and cannot not build my app anymore on my iPhone. Building it in the simulator works, but not in the iPhone. #import <...
  • 119
0 votes
1 answer
36 views

Fetch text UIColor in XCUITest

I am writing UI tests from my watchOS project and currently looking how to fetch UIColor attribute from from UILabel and UIButton in XCUIText? Maybe someone knows how to do it?
  • 135
0 votes
1 answer
204 views

Change word colour from sentence with regex

I have sentence "This is my first test", I need to change for example word "first" to another colour. But this sentences will come from backend. So,i need maybe with regex take ...
1 vote
1 answer
421 views

How to find current color in UIImageView and change repeatedly?

I have this UIImageView where I am only changing the white color of the image. When the white color changes it doesn't change again because the white color is no longer white anymore. I want to access ...
user avatar
0 votes
1 answer
198 views

Cant convert string hex into hexint and then into UIColor [duplicate]

I have JSON Data with an array of strings. When I decode this data I need to convert strings into ints and then use it for creating UIColors. But when I convert my hexadecimal from string to int it ...
1 vote
0 answers
194 views

How can I change Calendar range selection colour in swift?

I want to change the background color of selection date from the first to last date dark and between light colour. I've researched other questions but it's not working. All I want to do is just change ...
3 votes
1 answer
622 views

Julia: How to change color of a group in plotly scatterplot

Say I have the following example code using PlotlyJS using CSV, DataFrames df = dataset(DataFrame, "iris") plot( df, x=:sepal_width, y=:sepal_length, color=:species, mode="...
  • 139
3 votes
1 answer
432 views

CGColorSpace name profile

let red = UIColor.red print(red.cgColor.colorSpace!) The output is <CGColorSpace 0x60000332d260> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1; extended range). How can I get ...
  • 2,419
0 votes
5 answers
529 views

How to set alpha for an Assets Color in Swift

I just wanted to know how to change the opacity (alpha) of an asset color I have. When I try this UIColor(named: "something", alpha: 0.4), Xcode complains: Extra argument 'alpha' in call. Is ...
user avatar
0 votes
0 answers
69 views

How create Paint or UIColor from Brush value in iOS

I'm developing MAUI project and having SelectionBackground API (in Brush type) and have to set this color to native view's (UIView) background (which is UIColor type) or set to IView's background (...
  • 474
0 votes
0 answers
152 views

iOS: Simulator crashes on trying to load SVG files?

I wanted to have some custom icons for my app, so I downloaded them from Icons8, in SVG Format. For reference, here is one the icons that I downloaded. When I try to show these icons in a collection ...
0 votes
1 answer
336 views

Swift, SwiftUI - .getRed(&red, green: &green, blue: &blue, alpha: &alpha)

I am following Stanfords' CS193p Developing Apps for iOS online course. I'm trying to do the Assignment 6 Memorize.pdf. It says to use this code below ⬇️, but it gives me always white color. Is there ...
0 votes
0 answers
99 views

Change color of whole app - for every item outlet necessary?

I have a color set in the assets catalog and I used this color now for all my buttons, labels, switches, image backgrounds and so on. I want to create now the ability for the user, to select it's own ...
  • 79
-1 votes
1 answer
150 views

SwiftUI: The compiler is unable to type-check this expression in reasonable time

I want to get the calendar color from EKEvent. But i´m getting the Error: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-...
2 votes
0 answers
222 views

Facing problems in converting SwiftUI Color to UIColor to save in user defaults

I am trying to save a SwiftUI Color instance to user defaults. My understanding of the process is to first convert the Color instance to UIColor, then use NSKeyedArchiver to convert it to Data, which ...
  • 105
0 votes
1 answer
56 views

Obj-C - Define UIColor property in NSObject?

I'm trying to define UIColor in an NSObject, but this doesn't seem do-able? Sorry for the basic question, but I can't seem to find why this wouldn't work? The property line throws me the error: ...
  • 1,307
0 votes
0 answers
171 views

Set Color Dark & Light Mode for label background

class func setColorLightDarkMode() -> UIColor { let aColor = UIColor(named: "StatusBackGroundColor") ?? .gray return aColor } label.backgroundColor = setColorLightDarkMode() ...
  • 4,237
0 votes
2 answers
383 views

iOS - Draw a view with gradient background

I have attached a rough sketch. The lines are deformed as the sketch was drawn manually just to illustrate the concept. As seen in the sketch, I have a list of points that has to be drawn on the view ...
  • 3,432
2 votes
1 answer
240 views

Reading named colors from pods assets

i have created my framework which include named colors that will be used in application but when i run the application it crashes with null error even color is included in assets file of pod. example ...
2 votes
1 answer
175 views

How does it know? When UIColor sets fill and UIGraphicsImageRendererContext knows how to fill

I came across an example for using UIGraphicsImageRender to draw in a tutor on Medium. The example code is as follows: let renderer = UIGraphicsImageRenderer(size: CGSize(width: 20, height: 20)) let ...
0 votes
1 answer
117 views

Unable to set correct background color to UISearchTextField

Please take a look at this code: - (void)viewDidLoad { [super viewDidLoad]; self.searchController = [[UISearchController alloc] ...
2 votes
1 answer
3k views

Cannot convert value of type 'Color' to expected argument type 'UIColor?' [duplicate]

hello everyone i'm trying to make a navbar with a hexacedimal color in the asset file named "tint" but i have this error "Cannot convert value of type 'Color' to expected argument type '...
0 votes
0 answers
257 views

How to change the value of static var?

To control all the colors in my app, i create an enum containing static colors variable. enum Color { static var mainColor = UIColor(named: "mainColor") static let red = UIColor(named: "...
  • 31
2 votes
1 answer
98 views

TextView borderColor Not Changing

I am trying to change the borderColor of a textView in Swift. If I set it using a preset color it works fine: inView.layer.borderColor = UIColor.green.cgColor However, when I try to set it to a ...
  • 125
0 votes
1 answer
26 views

How can I change selected item color in non editor panel of Eclise?

I am Using Eclipse Neon 3 with darkest dark theme. The color of text and background of selected items are very similar in Project explorer, Search and any other non editor panel as shown below so it ...
  • 1
0 votes
1 answer
195 views

Colorwithpattern for coreimage color

I am using CIAztecCodeGenerator to generate an Aztec code. I'm trying to set a pattern instead of a solid color for the foreground color for it however it is rendering as blank/white I was wondering ...

1
2 3 4 5
29