Indigo icon indicating copy to clipboard operation
Indigo copied to clipboard

[.NET] reset 'render-background-color' to transparent

Open rbri opened this issue 2 years ago • 1 comments

Background We are using the renderer from a .Net application - works great. Currently we like to customize the renderer to let the user change various settings using a dialog. But so far i found no way to set the "render-background-color" back to the default value (transparent). But the indigo.setOption("render-background-color", ...); accepts (as far as i can see) only RGB values - no chance to provide a transparency info.

Solution Maybe there is already a way to do that - in this case it will be great if you can add this to the documentation. Otherwise having a pseudo value to set the value back to the default.

Again thanks a lot for the great tool.

rbri avatar Dec 08 '23 09:12 rbri

1. Description:

The issue is that the indigo.setOption("render-background-color", ...) method in the Indigo renderer, used within a .NET application, does not allow setting the background color back to its default transparent value. It only accepts RGB values, with no option to specify transparency or reset to the default setting. A hypothetical cause could be the lack of a dedicated parameter or pseudo-value in the Indigo API to restore the default transparent background.


2. Steps to Reproduce:

  • Step 1: Integrate the Indigo renderer into a .NET application and configure it to render molecular structures.
  • Step 2: Use the method indigo.setOption("render-background-color", ...) with an RGB value (e.g., indigo.setOption("render-background-color", "255,255,255")) to set a custom background color.
  • Step 3: Attempt to reset the background color to the default transparent value using indigo.setOption("render-background-color", ...) with various inputs (e.g., empty string, "transparent", or null).
  • Step 4: Observe that the background remains the last set RGB color and does not revert to transparent.

3. Expected Behavior:

The indigo.setOption("render-background-color", ...) method should allow resetting the background color to its default transparent state, either by accepting a special value (e.g., "default" or "transparent") or providing a separate API call to restore defaults. The rendered image should display a transparent background as the default behavior.


4. Actual Behavior:

The indigo.setOption("render-background-color", ...) method only accepts RGB values (e.g., "255,255,255"), and there is no apparent way to set the background to transparent or revert to the default setting. The background remains the last specified RGB color, with the error reproducible in 100% of cases when attempting to reset it without a valid transparency option.


5. Analysis of the Problem:

The problem likely arises because the Indigo API does not currently support a mechanism to reset the render-background-color option to its default transparent state, limiting the method to RGB input only. This could be due to:

  • An intentional design choice to enforce explicit color settings without a default reset option.
  • Lack of documentation or an undocumented pseudo-value for transparency. Involved modules: Indigo renderer API. No chemical validation is needed, as this is a rendering configuration issue.

6. Suggested Solutions:

  • High-level solution: Enhance the user interface in the .NET application to include a "Reset to Default" option for rendering settings, which could trigger a known default value if supported by Indigo.
  • Technical solution: Introduce a pseudo-value (e.g., "default" or "transparent") in the indigo.setOption("render-background-color", ...) method to revert to the transparent background. Example workaround in .NET:
    using Indigo;
    
    public void ResetBackgroundColor(Indigo indigo)
    {
        // Attempt to set a pseudo-value (if supported in future updates)
        indigo.SetOption("render-background-color", "default");
        // Fallback: Set a known transparent-equivalent RGB if default is not supported
        indigo.SetOption("render-background-color", "0,0,0,0"); // RGBA with alpha, if extended
    }
    
  • Documentation improvement: Update the Indigo documentation to clarify how to reset render-background-color to transparent, including any supported pseudo-values or alternative methods.

mobilisf avatar Jun 19 '25 09:06 mobilisf