Skip to content

Named Color

MOARdV edited this page May 25, 2016 · 1 revision

Many of the prop modules in RasterPropMonitor allow color shifting to simulate lights that turn on, for instance. Many times, a simple sequence of RGBA values is sufficient to configure these color (for instance, positiveColor = 248, 220, 210, 255).

There are two situations where that can be inconvenient: when configuring an IVA (trying to pick or tweak a particular color, such as illuminated text color), and when customizing the experience in a particular pod (using warmer colors to simulate incandescent bulbs instead of bluer colors to simulate cool-tone LEDs).

In the first situation, adjusting one color requires editing many places in many config files, which is tedious and error-prone. In the second situation, the IVA maker has to make an entirely new prop simply to change the lighting options.

To address both of these situations, RasterPropMonitor supports the use of Named Colors. These colors are defined in config files, and they allow the use of a name to define the color, such as COLOR_MOARdV_IlluminatedText, instead of an RGBA sequence. Using the name allows a single edit to update the colors of every prop using that color.

In addition, the RasterPropMonitorComputer module allows for per-part override colors. These override colors affect only the props installed in the same part as the RPMC module. This allows an IVA maker to use the same prop in multiple IVAs with different color schemes as controlled by the part where the prop is installed.

When a named color is specified, but it is not found, RasterPropMonitor will log an error in log file and return the color (255, 0, 255, 255).

Global Colors

Global colors are defined in config files at the root level (either in their own file, or in an existing file). They consist of config nodes that contain a name and an RGBA color definition. Multiple global color definition nodes may exist. If multiple nodes define the same name, the last node will decide the color. A global color config looks like this:

RPM_GLOBALCOLORSETUP
{
  COLORDEFINITION
  {
    name = MOARdV_BacklightColor
    color =  255, 248, 213, 255
  }

  COLORDEFINITION
  {
    name = MOARdV_UnlitText
    color =  213, 213, 213, 255
  }

  COLORDEFINITION
  {
    name = MOARdV_UnlitBlackText
    color =  8, 8, 8, 255
  }
}

To select a color, prefix the name of the color with 'COLOR_' (eg, passiveColor = COLOR_MOARdV_UnlitText).

Part Overrides

When the global colors are incorrect for a particular IVA design, per-part overrides can be used. These override colors will be applied only to props inside the part that has the override definition - if a different part in the same craft does not have overrides, it will use the global colors. A part override may include color definitions that are not found in the global color definitions. The override color is used within that part.

The override looks like this:

MODULE
{
  name = RasterPropMonitorComputer
  RPM_COLOROVERRIDE
  {
    COLORDEFINITION
    {
      name = MOARdV_UnlitText
      color= 255, 248, 213, 255
  }
  }
}

In this example, any prop using 'MOARdV_UnlitText' will use (255, 248, 213, 255) instead of the global color defined earlier of (213, 213, 213, 255).

Availability

This feature works in the following prop modules. This is an optional feature - IVA makers can still use RGBA colors if they prefer.

  • JSIActionGroupSwitch disabledColor and enabledColor.
  • JSICallbackAnimator activeColor and passiveColor.
  • JSILabel negativeColor, positiveColor, and zeroColor.
  • JSISwitchableVariableLabel color.
  • JSIVariableAnimator activeColor and passiveColor.
  • JSIVariableLabel negativeColor, positiveColor, and zeroColor.