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).

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?

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.

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?

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.

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.

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.

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.

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?

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).