zeitlings Posted August 20, 2023 Share Posted August 20, 2023 (edited) Pick a color to get its hex, rgba, hsl representation or NSColor initializer. Usage Activate the Color Sampler with the keyword (default: cp) and pick the desired color. Color History To review previously picked colors, activate the workflow with the keyword preceded by a colon (default: :cp). Edited June 11 by zeitlings pseudometa, Belfong, yinan and 1 other 3 1 Link to comment
zeitlings Posted April 4 Author Share Posted April 4 (edited) v1.2.0 implements the new grid view for the color history Edited June 11 by zeitlings yinan, JJJJ and Grug 3 Link to comment
Textdriven Posted April 18 Share Posted April 18 (edited) Am i missing something? I type cp and hit enter. Nothing appears. Alfred 5.5, macOS Version 14.4.1 (23E224) [2:22:24.177 PM] Color Picker[Keyword] Processing complete [2:22:24.183 PM] Color Picker[Keyword] Passing output '' to Script Filter [2:22:24.195 PM] Color Picker[Script Filter] Queuing argument '(null)' If i run :cp [2:25:47.841 PM] Color Picker[Keyword] Passing output '' to Automation Task [2:25:47.843 PM] ERROR: Color Picker[Automation Task] Task Argument Error: Expecting single or multiple inputs. Warnings: ( "Passed in file '/Users/user/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.zeitlings.colorpicker' does not exist, discarding" Edited April 18 by Textdriven Grug 1 Link to comment
zeitlings Posted April 20 Author Share Posted April 20 (edited) Hey @Textdriven Unfortunately, there is no error message in the logs to suggest a solution. :cp doesn’t work because there is no color history to show yet. The only thing I can think of is this: The script is compiled on your device the first time you run the workflow. This seems to be required since macOS 14. For this to work, you may still need to install the Xcode command line tools to run the swiftc command that compiles the swift code into an executable. This can be done by running the following command in the terminal: xcode-select --install However, if I'm not mistaken, macOS should have prompted you with a popup asking you to install the command line tools if they are not present 🤷♂️ Edited April 20 by zeitlings Link to comment
clement Posted April 26 Share Posted April 26 (edited) I'm getting this error: [14:23:10.784] Color Picker[Keyword] Processing complete [14:23:10.786] Color Picker[Keyword] Passing output '' to Script Filter [14:23:10.788] Color Picker[Script Filter] Queuing argument '(null)' [14:23:11.406] Color Picker[Script Filter] Script with argv '(null)' finished [14:23:11.408] ERROR: Color Picker[Script Filter] Code 127: ColorPicker.swift:78:13: error: use of undeclared type 'FloatingPointFormatStyle' let pfms: FloatingPointFormatStyle<CGFloat> = .init(locale: Locale(identifier: "en_US")).precision(.fractionLength(5)) ^~~~~~~~~~~~~~~~~~~~~~~~ ColorPicker.swift:87:18: error: no exact matches in call to initializer let url: URL = URL(filePath: "\(cache)/\(hex).png") ^ Foundation.URL:12:12: note: incorrect labels for candidate (have: '(filePath:)', expected: '(fileURLWithPath:)') public init(fileURLWithPath path: __shared String) ^ Foundation.URL:2:12: note: incorrect labels for candidate (have: '(filePath:)', expected: '(fileReferenceLiteralResourceName:)') public init(fileReferenceLiteralResourceName name: String) ^ /Users/clementrousseau/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/1A4D2298-2D48-42DB-97C0-D53AB465EEB2:2: no such file or directory: ./ColorPicker MacOS: 12.5.1 Alfred: 5.5 Edited April 26 by clement Formatting code Link to comment
zeitlings Posted April 26 Author Share Posted April 26 3 hours ago, clement said: MacOS: 12.5.1 Your OS is too old for at least one of the functions called here. I'll check if I can add support for macOS 12. Link to comment
zeitlings Posted April 27 Author Share Posted April 27 @clement You can try again now with the updated version from Github. Let me know if it works! Link to comment
Textdriven Posted April 30 Share Posted April 30 On 4/20/2024 at 10:02 AM, zeitlings said: Hey @Textdriven Unfortunately, there is no error message in the logs to suggest a solution. :cp doesn’t work because there is no color history to show yet. The only thing I can think of is this: The script is compiled on your device the first time you run the workflow. This seems to be required since macOS 14. For this to work, you may still need to install the Xcode command line tools to run the swiftc command that compiles the swift code into an executable. This can be done by running the following command in the terminal: xcode-select --install However, if I'm not mistaken, macOS should have prompted you with a popup asking you to install the command line tools if they are not present 🤷♂️ It looks like this were already there $ xcode-select --install xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates However if then try to compile ColorPicker.swift with swiftc command i get tons lots of errors like this.... error: cannot find type 'any' in scope error: '@inlinable' attribute cannot be applied to stored error: method does not override any method from its superclass Link to comment
zeitlings Posted June 11 Author Share Posted June 11 46 minutes ago, Paliz said: Thanks, excellent workflow! You're welcome 🤗 On 4/30/2024 at 11:15 PM, Textdriven said: It looks like this were already there $ xcode-select --install xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates However if then try to compile ColorPicker.swift with swiftc command i get tons lots of errors like this.... error: cannot find type 'any' in scope error: '@inlinable' attribute cannot be applied to stored error: method does not override any method from its superclass For future reference, installing Xcode from the App Store is what fixed this issue for @Textdriven. Paliz 1 Link to comment
zeitlings Posted June 15 Author Share Posted June 15 v1.3.0 Added dependency handling Improved error handling Refactored code Link to comment
tTWkmTcB Posted Tuesday at 08:49 PM Share Posted Tuesday at 08:49 PM Really very useful workflow ! As a front-end developer, I think it could be helpful to add a feature to give a name to the color. https://chir.ag/projects/name-that-color/ https://www.popclip.app/extensions/x/zn9dyt Thank you again for the work 🙏 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now