Trick #3: Changing Tab Color When Selected.
Okay, this one is real simple and I'm sure most of you can figure it out, but I think it's such a good feature I want to bring attention to it.
Note: Changing colors of objects, whether it's tabs or buttons, is much easier to do if you're storing your custom color values in variables. That way, if you decide your blue buttons need to be a slightly darker shade of blue, all you need to do is change the definition of the variable and all your objects will automatically update.
For this example we'll assume you've added the following (or similar) to your script:
Let vActiveTabColor = rgb(100,100,200);
Let vInactiveTabColor= rgb(200,200,200);
Create a variable (ex: vActiveSheetID) to contain the ID of the currently active sheet.
Do the following for each sheet you create through the sheet's Properties dialog:
Add an OnActivate action via External -> Set Variable -> vActiveSheetID and specify a value of the ID of the current sheet.
Select custom tab color in your sheet's Properties dialog. Choose the expression option and specify:
=if( vActiveSheetID='this sheet ID', vActiveTabColor, vInactiveTabColor)
Note that if you're using two colors of different contrast, you'll probably also have to dynamically adjust the color of your font, otherwise the sheet name can become unreadable. To do this, go into the tab's Font properties and specify a color expression similar to:
=if( vActiveSheetID='this sheet ID', white(), black())
Obviously you have to replace 'this sheet ID' with actual sheet IDs.
Subscribe to:
Posts (Atom)
This is great Steve - Thank you. Adds a nice little aesthetic touch.
ReplyDelete