Add the username colour as a CSS variable

We’d like to be able to access the injected/inline username RGB colour as a CSS variable (e.g. var(--nick-color-r), var(--nick-color-g), var(--nick-color-b))

It would be as simple as putting --nick-color-r: <the nickname color's r component>, ...; alongside the injected color: style.

A example usage would be:

(the inline color)

element {
	color: rgb(255, 105, 180);
	--nick-color-r: 255;
	--nick-color-g: 105;
	--nick-color-b: 180;
}

(the nick)

.nick {
	background-color: rgb(var(--b), var(--b), var(--b));
	--b: calc((((
               (var(--nick-color-r) * 299)
             + (var(--nick-color-g) * 587)
             + (var(--nick-color-b) * 114)
         ) / 1000) - 128) * -1000);
}

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.