Extract color code
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9867
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Extract color code
IIRC someone here or on the mailing list posted a CMYK conversion function within the last few years.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 7266
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Extract color code
I've noticed that if I set the color from the hex pane of the color picker then that's what I get back when querying for the color. Not sure if that's useful in this case.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Extract color code
This shows at least one simple and direct conversion:
https://www.rapidtables.com/convert/col ... o-rgb.html
Though I have read that because the two worlds these protocols live in, print, which has four elements (CYMK) and is subtractive, and screen, which has three elements (RGB) and is additive, the conversion is not so simple.
Craig
https://www.rapidtables.com/convert/col ... o-rgb.html
Though I have read that because the two worlds these protocols live in, print, which has four elements (CYMK) and is subtractive, and screen, which has three elements (RGB) and is additive, the conversion is not so simple.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 4036
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Extract color code
Here is a stack that has color type conversions from Monte Goulding. I made small corrections to it and post it here.
I talked about this stack with Monte way back on a conference in Edinburgh and he was fine with the corrections to the library and did not mind it being in the public domain. It would be nice to give him credit when using it in your project.
Kind regards
Bernd
I talked about this stack with Monte way back on a conference in Edinburgh and he was fine with the corrections to the library and did not mind it being in the public domain. It would be nice to give him credit when using it in your project.
Kind regards
Bernd
- Attachments
-
- libColor_Monte_BN.livecode.zip
- (19.19 KiB) Downloaded 76 times
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Extract color code
Here's a fairly goofy question:
What does max mean in this context?
K = 1-max(R', G', B')
"Its the short form of representing, a function that returns maximum among a set of given numbers."
https://math.stackexchange.com/question ... s-max-mean
- -
Ah: nothing quite like the "soggy toast" feeling of answering one's own questions.
What does max mean in this context?
K = 1-max(R', G', B')
"Its the short form of representing, a function that returns maximum among a set of given numbers."
https://math.stackexchange.com/question ... s-max-mean
- -
Ah: nothing quite like the "soggy toast" feeling of answering one's own questions.
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Extract color code
Convert RGB 'guff' into CMYK 'guff'.
15 minutes on 2 very strong Gin-and-Tonics proving that the Maths on this page is
OFF by a factor of 100:
https://www.rapidtables.com/convert/col ... -cmyk.html
Stack removed as improved version posted in next post.
-
- Livecode Opensource Backer
- Posts: 9476
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Extract color code
As I have never had to do this in the last 20-odd years what on earth prompted me
to look up round in the Dictionary . . .
- Attachments
-
- CoMe-YucK.livecode.zip
- (1.11 KiB) Downloaded 85 times
-
- Posts: 637
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: Extract color code
A couple years late to this thread, but I just wanted to add (re-CMYK) that as mentioned they're two different color worlds, additive color vs. subtractive color, so there's no perfectly correct conversion to be had.
Usually there's some adjustment made in the process of converting to CMYK from RGB, that is there's usually a color curve applied that's (probably not) calibrated to a printing device. This is referred to as GCR (gray component replacement) or UCR (under color removal).
So there's my $0.02
Usually there's some adjustment made in the process of converting to CMYK from RGB, that is there's usually a color curve applied that's (probably not) calibrated to a printing device. This is referred to as GCR (gray component replacement) or UCR (under color removal).
So there's my $0.02
Re: Extract color code
Also late to this, but just to add that the FerrusLogic team have previously ported the javascript framework TinyColor to liveCode and made it available as opensource on GitHub under the extremely permissive MIT licence (you just need to include the licence info and use in any commercial/non-commercial way you see fit): https://github.com/Ferruslogic/TinyColor
This does a ton of colour conversions and has around 70 functions. A valuable library and contribution
While it is always fun to learn by doing, to be productive using libraries like this are a must... just posting for awareness.
Stam
This does a ton of colour conversions and has around 70 functions. A valuable library and contribution
While it is always fun to learn by doing, to be productive using libraries like this are a must... just posting for awareness.
Stam
-
- Posts: 637
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: Extract color code
Right, I knew that but your posting that link (thanks) had me looking at it again and just notice there's a nice function in there:
getSystemAppearance() to check if operating system is in dark or light mode that works on Mac,iOS, Android, and Windows.
The only problem is it doesn't do Linuxes, I'm looking into doing something like that (there's a lot of variations in Linux world to consider).
There's also none for running in a browser (Emscripten / HTML5), that's easy enough to get from web API.
As seen here, fourth button from top right side: http://openxtalk.org//WebStacks/HC3PlusPlus.html