Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Can agents change shade of a color only? (Read 11892 times)
briankpenney
Full Member
*
Offline



Posts: 7

Can agents change shade of a color only?
May 10th, 2008, 11:43pm
 
I have a to do list where items are color coded by type of project (e.g. Research is orange, Teaching is red). I would like to have an agent change the shade of color once the to do is complete, so anything red becomes dark red, etc. However, I have tried the agent action

Color=$Color + " dark"

does not seem to work. I know I could get separate agents to search for red, completed To dos and change these to dark red, etc. However, I am hoping for one agent that can just darken regardless of the color, as I also hope to have "someday" items colored lighter, etc. and I don't want to have separate agents for every combination. Any ideas?

Thanks- Brian
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Can agents change shade of a color only?
Reply #1 - May 11th, 2008, 6:50am
 
See manual pp259-261. Use colour operators:
Color = brightness(Color,85)

That resets the colour to the same colour at 85% lightness (100% = bright, 0% = dark). OK, you will need to figure out the starting brightnesses,but there's code to help with that too! Ue this btrghtness() syntax with a custom attribute to collect the value:
MyString=brightness("green")
... which gives you a MyString value of '59.7665', i.e. 59.7665% brightness. From that base level you can decide the brightness you want. Note that a colour can either be a named TB colour or a hex value (#ff0000 is bright red).

You may find that to make your system work, you might want to review the TB default colour palette and tweak it to you own custom version (TB supports custom palettes) so that all colours you'll be amending as above use a common baseline brightness.

Anyway, the above are the tools you're looking for
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
briankpenney
Full Member
*
Offline



Posts: 7

Re: Can agents change shade of a color only?
Reply #2 - May 12th, 2008, 9:40am
 
Thanks for the tip! However, it doesn't seem to work for me exactly as advertised. I can darker the color of the name by using Color=brightness($Color, 50)
And it works fine. However, if I try to lighten the color by using Color=saturation($Color, 10)
the name becomes black. Any thoughts here?

Thanks- Brian
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Can agents change shade of a color only?
Reply #3 - May 12th, 2008, 10:21am
 
Right you are!  Hue() and Saturation() in 4.2.4 are mistakenly controlling brightness, not hue and saturation.

This will be fixed in the next release.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Can agents change shade of a color only?
Reply #4 - May 12th, 2008, 10:49am
 
Well is would as lower numbers are darker, higher numbers are lighter, i.e. the opposite of what you tried. Thus if you were to start with a colour of default brightness of 50(%), that any figure of less than 50 in a brightness call will darken it and the opposite for any figure over 50. Remember too you need to know the brightness of the colour you'll start with so as to know whether the figure you're passing is higher or lower.

You might want to revisit the manual ref and look at this page too. Whilst experimenting, I'd advise using a small new text TBX so you can test without prototypes and other things interfering. Then when you're comfy with the basic syntax you can add it back into your main TBX knowing than any failures arising may be due to the interaction of other TBX automation and not from errors in the basic action syntax for colours.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Can agents change shade of a color only?
Reply #5 - May 12th, 2008, 10:52am
 
Brian. While I was replying, Mark B spotted a glitch, but do bear in mind your quoted example - with a brightness figure of '10' would likely result in a dark colour even if hue/saturation aren't interfering.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Can agents change shade of a color only?
Reply #6 - May 12th, 2008, 11:49am
 
Further to what MarkA just said, saturation($Color,10) means, "pretty much the same as the current color, except nearly gray with just the barest trace of color."

brightness($Color,10) would mean, "pretty much like the current color, except very very dark."

Back to top
 
« Last Edit: May 12th, 2008, 11:50am by Mark Bernstein »  
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Can agents change shade of a color only?
Reply #7 - May 12th, 2008, 1:29pm
 
The manual - and my aTbRef web pages - are unintentionally misleading as the common source text of both implies the actions offered only reduced or more of brightness/hue/saturation when in fact they can be increased or decreased.

I think what the OP wants do do, assuming an intent to increase brightness by 20%, is:

Color=brightness($Color,(brightness($Color)*1.2))

...except in my test agent  that turned default blue to a bright green!!...and then a brighter blue (what I intended), then bright green, (and prest...). Looks like the code above works but the HSV interference problem Mark B has identified is upsetting the result and the method may thus not work exactly as intended until the underlying glitch is fixed.

Looking forward, glass half full, to that point let me deconstruct the above. Starting in the middle:
brightness($Color)
gives us the brightness value of the current Color. We multiply it by 1.2 to get a value 20% higher:
brightness($Color)*1.2
...and to re-set the note's Color we use the other brightness syntax of brightness(Colour/Attribute, %brightness), i.e.:
Color=brightness($Color,(brightness($Color)*1.2))

I reiterate though, that this seemingly doesn't yet work correctly in v4.2.4.

[Later: the aTbRef page has been corrected]
Back to top
 
« Last Edit: May 12th, 2008, 1:41pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Can agents change shade of a color only?
Reply #8 - May 12th, 2008, 4:31pm
 
Of course, if this were a rule, we'd increase brightness every time the rule ran until it pegged (or overflowed).

If it were an agent, this would happen each time the agent found the note.  So, the agent needs to remove the trigger after changing the brightness, OR simply set the brightness to some constant.
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Can agents change shade of a color only?
Reply #9 - May 12th, 2008, 5:57pm
 
I did wonder, though how light blue becomes bright green only by shifting brightness isn't clear. A better example then is this agent action:
if (MyBool=true){Color=brightness($Color,85);MyBool=false;}

Using an expression to modify the brightness doesn't product the same result. Default 'magenta' has a brightness of 39.8%.  So a factor of 2.12 (I'll round to 2) should produce the same effect as above.
if (MyBool=true)
{MyNum=brightness($Color);
Color=brightness($Color,(brightness($Color)*2));
MyBool=false;}

...but it doesn't. Line breaks in the action are for clarity here.

Are expressions allowed in colour operators? My hunch is not (no reason they should be!). I've only followed this concept through since someone asked above 'how' but havng done so I'm not convinced the is the best way of altering colours. This is because just setting brightness, for example, requires careful choice of the start colour and doesn't work well if Outline (my normal view) darkening is turned on - the default IIRC. It works better in Map view. I just sense there may be easier ways to alter the colour of notes to reflect state.

Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
briankpenney
Full Member
*
Offline



Posts: 7

Re: Can agents change shade of a color only?
Reply #10 - May 14th, 2008, 8:55pm
 
Further to what MarkA just said, saturation($Color,10) means, "pretty much the same as the current color, except nearly gray with just the barest trace of color.

MarkB: that helps a lot, and what I was hoping to do with the agent. I'll look forward to the next release. In the meantime, my temporary fix is namebold=true for one state and false for the other, instead of lightening the color. My only goal is to have it so current To Dos jump out, and "Someday" items are readable but fade into the background easily.

MarkA: You mentioned the blue getting changed to green in your example. I find this happens when Tinderbox is confused at what I am trying to do with color. E.g. use the Quick Stamp to set a note's color to "Blue" (yes, capitalize it) and the color will instead be a less-than-attractive bright green. It's note icon will also change color briefly when you select it, or then select something else.

MarkB: Any particular reason Tinderbox goes to this particular color when it is confused? Is this a feature to help us spot color commands that are not working?
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Can agents change shade of a color only?
Reply #11 - May 15th, 2008, 7:39am
 
Brain, I believe my the 'green effect' test suffered from 2 factors. Firstly, I was inadvertently re-calling the my brightness action which was increasing the brightness each time - at some point you're calling what equates to >100% and by the law of unintended consequences (as in out use of this feature) that's not something TB's handling as we expect. I presume the colour's hue shift is an error showing through though I doubt the exact colour seen is significant (i.e. don't expect to get the same 'error'  every time).

MarkB also alluded to possible unintended interaction of the brightness/hue/saturation commands though I suspect the detail is still under investigation.

I suspect the range within which colours are noticeably different - in your usage context - is probably a smaller part of the colour wheel than imagined,, Given that, I'd investigate making you own custom palette with a larger number of named colours  - whose distinctness you're happy with - and then apply those colours by name in your code.  I suspect it will be a lot less trouble than the colour maths we're getting into here.

The TB colour palette (a tab on the Attributes dialogue - Cmd+2) has no new button, so adding new colours can be a little unintuitive.  In the Name box type the name of your new colour.  If you know the hex colour value you want to use type that in the 'Color' box (e.g. #ff0000 is bright red - letters aren't case sensitive). If you don't know the exact colour value, leave the  box blank as the colour picker isn't available until we've added the new colour. Click the change button, your colour is now added to the list (for the current TBX) and defaults to #000000 (black) if you didn't set a colour. You can now use the colour picker button and it will automatically return the hex value of the colour you choose. Click Change again to save the new colour value. Once you've set you new colours, you can use the 'save' button to save a TB colour palette file that you can drag onto other TBXs to apply or set as your default via custom config files (aTbRef describes the latter process).

Back to top
 
« Last Edit: May 15th, 2008, 8:23am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
More ways to make notes stand out
Reply #12 - May 15th, 2008, 11:58am
 
In  An Interesting Tinderbox Task http://www.markbernstein.org/May0801/AnInterestingTinderboxTask.html , I describe a similar problem.  I'm assigning people to a bunch of tasks; when a task is sufficienty staffed, I want it to be less prominent.

I did this by making unstaffed task names white, while staffed tasks draw their name in very light blue.  It's a subtle difference, but sufficient.

More useful ways to highlight notes: add a border, use a pattern and change Color2, add a badge.

If you use restraint in all these effects, you can communicate a lot of information without making the display too noisy or gaudy for prolonged use.
Back to top
 
« Last Edit: May 15th, 2008, 12:00pm by Mark Bernstein »  
WWW   IP Logged
Pages: 1
Send Topic Print