PITSS Tech Blog
News zu Java, PL/SQL, Entwicklung & TechnologiewechselHow to Use Custom Color Schema in Oracle Forms 12c
Starting point is an existing Forms application, in our case the summit sample from Oracle. Without any changes, the look and feel of the application is like this:
If you like to adopt the color schema, you could simply add the colorSchema configuration to the formsweb.cfg file or directly into the command line of the FSAL call, e.g. colorSchema=Red.
Unfortunately this will result in only minor adjustments, cause the developer of the app once decide to hardcode every color either directly on the object or due to Visual attributes. If you really want to benefit from colorschemas, you have to rely on “virtual colors”. These are described in the Oracle Forms documentation:
With this you could directly see the difference in the colorschemas, e.g.
If you leave the color “undefined”, the default color of the object is taken, otherwise you should use one of the “virtual colors” from above. Beside this you could also take any other color (like black for text foreground color) if you do not want to change the color in any colorschema.
But – how to change millions of color assignments inside your application? Isn’t that the no-go-criteria for this feature.
Therefor we could perfectly use PITSS.CON with the feature of Change Properties. Like every development task, this should start with a quick analyse, to identify the amount of work. In the PITSS.CON Cube, you could select the different colors and used Visual Attributes inside a specific module. In the summit sample we identify for the customers module:
The button has an own Visual Attribute, and the Canvas has an own color. With this information, we now what to do. Remove backgroundcolor in every object and define the attributes for a simple Button.
See the necessary steps in the following screenshots:
To delete a backgroundcolor we use 4 stars **** as an attribute value. You could store these steps into a template to make them rerunnable for any other project, module, etc.
Before the changement take place, you could cross check the results and manually remove single objects.
Repeat this step for Items, windows and tab pages as well. And last but not least, change the color for the named Visual Attributes. For a complete application, you should once think about your UX (like color of required fields, read only, critical values, etc…) and change them in the library.
At least you should update and deploy your module.
In complete these changes took no longer than 5 minutes of work, independent of the size of your application. After that – Red is red…
… and BLAF is blaf.
Beside the given color schemes from Oracle, you could even define your own one. This is possible inside the Registry.dat with the following description:
# Sample custom color scheme
colorScheme.sample.description=Sample custom color scheme
colorScheme.sample.lightest=0xFFA941
colorScheme.sample.lighter=0xFFA15B
colorScheme.sample.light=0xF07414
colorScheme.sample.dark=0xFF4F59
colorScheme.sample.darker=0x666666
colorScheme.sample.darkest=0x000000
colorScheme.sample.selection=0x5CC7E4
colorScheme.sample.pinstripe1=0x518FEB
colorScheme.sample.pinstripe2=0x2001aC
If you change the formsweb.cfg propery customcolorscheme=sample (in that case) you could create your complete own look and feel:
The three screenshots are made without any code change inside Oracle Forms.
At the end you could with this easily distinguish between different Installation like Dev, Q&A, Test or production, or inside a common infrastructure, e.g in the cloud, for different customers. As an ISV you could adjust the Colors along with customer wishes, without any code change.