Jump to content

[IPS 4.5] Changing the color from HEX to RGB - Theme fields


aXenDev
 Share

Recommended Posts

Hi,

I created my own test field to test the colors.
image.thumb.png.0e3ad4b270de3a9148fdc5e2fc89cb0b.png

I paste this value into CSS using:

{theme='test_color'}

Question: How do I change the value from HEX to RGB? I would like to put this value in a variable as it is done in the default IPS theme (:root)

Instead:

:root {
	--test-var-color: {theme='test_color'};
}

Effect:
:root {
	--test-var-color: #2193e6;
}

I want it to look like this:

:root {
	--test-var-color: {theme='test_color'};
}

Effect:
:root {
	--test-var-color: 33, 147, 230;
}

Is there a ready way for this? Do I need to change this value using a function in php?
If there is a ready solution, I suggest adding this to the documentation.

Link to comment
Share on other sites

Any theme settings that are "color" fields will automatically be turned into CSS variables for you. If your theme setting has the key "test_color" (like in your screenshot), the CSS variable will be named --theme-test_color. No need to create the CSS variables yourself 🙂 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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