Can't submit userstyle; "Style code has an error"
I'm trying to submit a new style, but it's telling me "Style code has an error - wrong number of arguments (given 1, expected 3..5)." It shows errors in the browser extension Stylus as well, but they're functional codes that it marks as errors. An example:
All the errors come from using an alpha value with a variable, but again, they work. I validated the entire style here and it gave no errors.
.nav.transparent, #app #nav.nav.transparent {background: rgba(var(--black),.5) !important;}
All the errors come from using an alpha value with a variable, but again, they work. I validated the entire style here and it gave no errors.
Comments
It works because the browsers are tolerant and correct the error.
Maybe the new specs allow that, but you better stick to a more strict syntax which also fulfills the needs of CSSLint (which has problems with CSS variables):
The alpha transparency is part of the colour and a 50% black can be written as
#00000088
or#0008
orrgba(0,0,0,0.5)
. So just integrate the alpha value into the variable.p.s.: If you want to keep it that way locally, you can get rid of the warning in Stylus editor by choosing Stylelint as linter.
Doesn't submit:
@-moz-document url-prefix("https://anilist.co/") { :root {--black: 18,18,18 !important;} .wrap .footer {background: rgb(var(--black)) !important;}}
Submits:
@-moz-document url-prefix("https://anilist.co/") { :root {--black: 18,18,18 !important;} .wrap .footer {background: rgba(var(--black)) !important;}}
!important
in the variable (and furthermore don't use double-important)Both of your examples corrected should both be valid: