https://youtu.be/kN9xP4aq3iA
Well done bogs: very impressive channel!
How to get the current brush color ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9386
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to get the current brush color ?
Sticking to LC you can use and if you into the message box, I found that LC understands 5390 colornames out of the box. Should be a good start.
In a former life I was an architect, and every office has a product library in a backroom somewhere that is filled with flooring, carpet, paint, plastic laminate etc. samples. Each of these products come in various colours - sometimes MANY colours (paint!) which each have a code and an English name. These names were a source of huge amusement and we all wondered who on earth came to the office each morning and dropped a tab of LSD, then toked up a big one and then sat down to name this year's set of colours. Some of the names very clearly had chemical help in their conception!
Code: Select all
the colornames
Code: Select all
put the length of the colornames
In a former life I was an architect, and every office has a product library in a backroom somewhere that is filled with flooring, carpet, paint, plastic laminate etc. samples. Each of these products come in various colours - sometimes MANY colours (paint!) which each have a code and an English name. These names were a source of huge amusement and we all wondered who on earth came to the office each morning and dropped a tab of LSD, then toked up a big one and then sat down to name this year's set of colours. Some of the names very clearly had chemical help in their conception!
-
- Livecode Opensource Backer
- Posts: 9386
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: How to get the current brush color ?
Well, be that as it may, when I did this:I found that LC understands 5390 colornames out of the box.
Code: Select all
put the colornames into fld "COLOURS"
Code: Select all
put the number of lines of fld "COLOURS"
Re: How to get the current brush color ?
Heh, "length" ≠ the number of lines of the colorNames, whatever on earth made you use length? Length returns the number of characters in a string, so I am VERY sure that 500+ names could easily return 10x that in characters
As Richmond points out, the colorNames function puts the names on separate lines by default, from the msg box you could simply use
or, if you really wanted to get fancy, maybe even
In any case, I completely agree with you, Lc provides more than enough color names. I wrote the utility I posted the link to there mostly because I thought it would be easier to actually see the color, and copy whatever values I needed from it, than it was to keep going back to the message box and get that information long hand from scratch each time.
Shockingly, it worked out rather well, if not overly attractive.
As Richmond points out, the colorNames function puts the names on separate lines by default, from the msg box you could simply use
Code: Select all
put the number of lines of the colorNames
or, if you really wanted to get fancy, maybe even
Code: Select all
put the number of lines of the colorNames & " Color Names are in the following list:" & cr & cr & the colorNames
Shockingly, it worked out rather well, if not overly attractive.