Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Change the color of a button in a script?

Featured Replies

Is there a way to change the color of an object (a button in particular) in a script?

Yes, there is.

Very simple with conditional formatting !

ButtonColor.zip

This, using a merge field as label, changes the button color and the button label.

( and the script has only one step, not needing the refresh )

ButtonColor_Label.zip

  • 3 months later...
  • Newbies

I see how you set up the script to toggle between the default and fill colors. Is it possible to assign a specific color (hex?) in the script. For example if I want the button background to be able to be set to multiple colors, I want to be able to tell it specifically which one it should change to (instead of toggling between two).

Thanks!

- Garrett

You can set up multiple conditions Under a Conditional Formatting for an object... So set up one for each color you want and then make the Formula choose which to display. Let's say you want Red, Green and Blue, set a variable in your script, call it $$ChangeColor (or whatever), that you set to be the color you want through the script... Then your Formula under Conditional Formatting is set with three (3) conditions / formulas, IF($$ChangeColor = "RED") It runs this condition, IF($$ChangeColor = "BLUE", than this condition, etc. There's probably a more elegant way to do this, but this is how I show different colored words on a manufacturing schedule report as certain criteria change to better highlight - tasks to go ahead (green), Problem hold (Red), DONE (gray-out), etc. As each line of each job goes to a different level or task it makes a large list a lot more readable for differnt users...

Hope this helps - the key is setting up your conditions. And if you want to duplicate the same Conditions list without having to retype, duplicate the object (word, or field) and then change it - this will keep the attributes of the condition for the new/next field. Format painter may work also but I don't know...

Kind regards,

Royce

  • Newbies

I appreciate the help and I think I am following your conditional logic. I actually have an even more basic question in terms of setting the color.

I cannot figure out how to write the syntax to actually change this to "Red" for example. I have a script that currently has:

Name: $$overdueBkgd (for example)

Value: Abs ($$overdueBkgd- 1)

This is the way it was originally set up earlier in the sample from this thread. I tried replacing the "1" with "Red" to no avail. How do I change this to a specific color. In my case I was trying to get it to set itself to the lightest gray in the color palette.

Thank you for your help!

- Garrett

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.