News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

TINT Function

Started by wapperdude, June 10, 2008, 06:50:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

wapperdude

I'm trying to use the TINT function in the Fill section of the shape sheet to set the foreground color to be a lighter shade of the background color, but keeping getting an error.  An example of the TINT function syntax would be most appreciated.
Visio 2019 Pro

wapperdude

I think I solved my problem.  I'm using Visio 2003 here at work.  The "TINT" function isn't listed for 2003, just 2007.  Limits backward compatibility.
Visio 2019 Pro

Visio Guy

Hi wapperdude,

Yes, Tint is new for Visio 2007. It won't "break" in Visio 2003--you should still be able to open drawings from 2007 in 2003--but I'm not sure what will happen to Tint formulas. Probably some form of being ignored.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

vojo

if you know the foreground, for a given shape, is lighter or darker than background, you can do the following

fillforegnd = <color from UI...dont use white or black depending on tinting higher or lower>
user.tint = RGB(RED(fillforegnd)+user.delta,GREEN(fillforegnd)+user.delta,BLUE(fillforegnd)+user.delta)
user.delta = <delta of tint...can be pos or neg number...probably should keep it at 15 or less>
fillbackgnd = guard(user.tint)

I actually use this approach to do shading of isometric cubes and vary it based on action buttons highlighting where light source is at.   Works well.

In general, if a color is say RGB (250,250,250), then may want limit so rollover does not give you black
I use the following:  user.backtint = RGB(RED(user.tint)>250,250,RED(user.tint), etc etc)
and plug backtint into fillbackgnd.

Visio Guy

Good tip, Vojo!

The ShapeSheet also has HSL functions (hue, saturation, luminosity), which I think are easier to use for creating lighter/darker shades. For instance, you can make a darker shade of red like this:

User.Red = RGB(255,0,0)
User.DkRed = HSL( HUE(User.Red), SAT(User.Red), LUM(User.Red)*.9 )


Note that luminosity values are good from 0 to 240. 0 makes black, 240 makes white. 120 is full saturation. So LUM(RGB(255,0,0)) = 120.

If you add or subtract values to make your shades, you need to ensure that they don't go below 0 or above 240.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 228 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1090KB.
Tokens: post-login.
Cache hits: 13: 0.00169s for 26,723 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]