4 Replies Latest reply on May 7, 2013 9:04 AM by deathrobot

    Defining global colors



      Defining global colors


           Is there a way to define global colors that can be used throughout the database? I have three different types of companies, and I use three different colors to represent those types. There are two different fields which show these colors plus three different text buttons; one of each color. Ideally, I'd like to define each color in a global field and have the text format and field format use those definitions so that it's easy to change the colors in all fields and on all layouts at once. I'm using Filemaker Pro Advanced 11

        • 1. Re: Defining global colors

               Are you changing text colors only or do some of these involve a change in the field's fill color? (Fill color changes would be a touch easier to set up than text colors.)

               I think you could do this pretty well with a table where you put one record for each company plus their color info, but for text, you'd want to store 3 numbers for their RGB values. And you would not use conditional format expressions for your colors. Instead, you'd place container fields behind your data or button lables to display fill colors and calculations in either calculation fields or as part of an auto-enter calculation (for fields you need to edit) could use the textcolor function to apply an RGB value looked up from your table of company colors.

          • 2. Re: Defining global colors

                 Hi Phil,

                 Thanks very much for your reply. Please forgive my newbieness, but I don't completely follow your explanation. Here's perhaps a better explanation of what I have:

                 1) a Table called "Companies" which contains the fields "company name" and "company category"
                 2) a text field that shows a colored bullet

                 3) 3 text buttons ("staff", "customers", and "vendors")

                 I need the fill color of the field "company category", the text color of the bullet,  and the text color of the 3 buttons to change based on the value of "company category". I currently am using conditional formatting, but of course should I decide to change the color values at a later time (for example, instead of "orange", "blue" and "purple" I decide to change to "green" "red" and "black"), I'd have to manually change the conditional formatting for each item and on multiple layouts. I'd like to have one place where I can define the three colors.

                 So, is there a way to define colors without pasting colored squares in global containers and using those on layouts? For text, where would I store the RGB values and how would those get called? Or do I need to give up on text color and only use the global containers for my color?



            • 3. Re: Defining global colors

                   I am sugesting that you paste colored squares into container fields, but these would be container fields defined in your companies table. This would appear to be all you'd need to get different fill colors that you can change for a given company by editing the color in one specific location.

                   When you use the color picker to select a color, The "other color" option can enable you to dermine the R, G and B values for a specific color. You can then store these values in three number fields in your companies table.

                   Then, to get text to display with the specified RGB values, you'd use either a text field with an auto-enter calculation or a calculation field with this expression to get the designated color:

                   TextColor (YourTextOrTextFieldHere ; RGB ( Companies::Red ; Companies::Green ; Companies::Blue ) )

                   or in an auto-entered calc:

                   TextColor ( self ; RGB ( Companies::Red ; Companies::Green ; Companies::Blue ) )

                   You'd use an auto-entered calculation on fields where you want the text color but need the field to be editable. The one catch to these fields is that changing the color values in Companies will not automatically update the fields that use an auto-enter calculation. You'd  need to use a script to update those fields for existing data any time you changed the color settings.

                   An alternative approach would be to set up your conditional format expressions with a "stack" of a large number of "preset" Fill and/or text color settings. Then you can make color assignments in a field in Companies to select one of those predefined formats for a given company. That's much less flexible, but easier to set up.

              • 4. Re: Defining global colors

                     Thanks, Phil. That's exactly what I need. Didn't realize I could set up text color in a calc. I suppose I could also make two fields for the text (there are only 4 total); one where I enter the info, and one that sits on top of it with your TextColor calc. That one would cover the one where I entered the info but not be modifiable.