Jump to content
  • Status: Moved to Github

I needed to add a number range setting to my theme for opacity. This would range from 0.1, 0.2, 0.3 etc up to 1.0 for full opacity.

E.g.

  • Minimum value 0

  • Maximum value 1

  • Step 0.10

When a default value e.g. 0.7 is entered and the form is saved:

image.png

when you next re-open the setting it has somehow changed to 0, which is also reflected on the front end settings and ultimately effects the CSS style sheet where the theme setting is used.

I have also tested using .7

image.png

image.png

It may be being reset to 0 because you cannot specify a minimum number other than a whole number such as 0.3, despite it having it having a step setting.

By comparison, if I used a dropdown, it does accept a default of 0.7 so it seems to be limited to the number type.

User Feedback

Recommended Comments

Ehren

Invision Community Team

You could just change the setting to 0-100.

You can then use either of these:

.class{
	opacity: calc(var(--setting) / 100);
}
.class{
	opacity: calc(var(--setting) * 1%);
}

I'll keep this bug report open though since it technically is a bug. But the above solutions will fix your specific issue.

The Old Man

Clients

Thanks both, much appreciated! 😄