Jump to content

Suggestion: Improve the hextorgb tag


Recommended Posts

Right now the tag is limited. Granted, it makes things a tiny bit cleaner but it doesn't actually solve the problem of allowing a user to adjust the opacity of an element through theme (or plugin) settings.

You aren't allowing the opacity option to carry through a setting - it must be hard coded. So, as is, if I want users to adjust the opacity of a color element I still have to do a bunch of hacky crap of if then statements and then hard code in a bunch of opacity options myself. And of course, I can;t jsut use a plain opacity css call with a theme setting as that will effect the entire element opacity and not the color element opacity specifically.

Lowest of hanging fruits is to just allow theme settings to pass through there on the opacity option in the tag. The code is essentially there already in the method, you are doing it with the color call, allowing the usual html # junk or grabbing a passed through theme setting - you just have to copy/paste that and fiddle with it a bit. Personally I'd love it if you would allow plugin (system) settings access to this stuff as well but I'll take what I can get. As soon as I can get it.

Make this happen guys. If you read this forum any more...


Link to comment
Share on other sites

  • 1 month later...

I'm not entirely sure if I'm understanding you correctly, so please clarify. The hextorgb template plugin (this is what you are referring to right?) does support opacity.

{hextorgb="FBFBFB" opacity="1"}

Were you not aware of the opacity option, or are you wanting to be able to set that in a different manner? Or are you wanting to pass through a variable and that's not getting converted into PHP code properly?

Link to comment
Share on other sites

		/* If a theme setting key has been passed in, then use that as the value */
		if ( isset( \IPS\Theme::i()->settings[ $data ] ) )
			$data = \IPS\Theme::i()->settings[ $data ];

@bfarber  It only evals for Theme settings on the main variable, not plugin/app settings ( \IPS\settings...) so that excludes plugins/apps from passing through anything here.

background-color: {hextorgb="page_background" opacity="0.6"}

Also we need the same settings check (both Theme and Settings settings) for $option. Nested template tags don't work, or at least I've never seen them working. It's probably why you are taking the theme setting name directly and not {hextorgb="{theme='page_background'}"}

It's less than two minutes to code - just dupe the above and add the /IPS/Settings check, and then copy paste the lot for the options call. Devs (theme/plugin/app) get a template plugin that is usuable across all areas of development and not just locked down to theme settings and color only.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...