Nuxt error with colors #71

Closed
opened 2026-10-15 15:21:42 +00:00 by Syndria98 · 2 comments
Owner
FRONTEND] WARNING: You probably don't mean to use the color value red in interpolation here.
[FRONTEND] It may end up represented as red, which will likely produce invalid CSS.
[FRONTEND] Always quote color names when using them as strings or map keys (for example, "red").
[FRONTEND] If you really want to use the color value here, use '"" + $name'.
[FRONTEND] 
[FRONTEND]     ╷
[FRONTEND] 111 │     --color-#{$name}: #{$value};
[FRONTEND]     │               ^^^^^
[FRONTEND]     ╵
[FRONTEND]     app/assets/css/colors.scss 111:15  theme-vars()
[FRONTEND]     app/assets/css/colors.scss 122:3   root stylesheet

Can you fix it?

``` FRONTEND] WARNING: You probably don't mean to use the color value red in interpolation here. [FRONTEND] It may end up represented as red, which will likely produce invalid CSS. [FRONTEND] Always quote color names when using them as strings or map keys (for example, "red"). [FRONTEND] If you really want to use the color value here, use '"" + $name'. [FRONTEND] [FRONTEND] ╷ [FRONTEND] 111 │ --color-#{$name}: #{$value}; [FRONTEND] │ ^^^^^ [FRONTEND] ╵ [FRONTEND] app/assets/css/colors.scss 111:15 theme-vars() [FRONTEND] app/assets/css/colors.scss 122:3 root stylesheet ``` Can you fix it?
Syndria98 added the ai-ready label 2026-10-15 15:21:42 +00:00
Agent added the working label 2026-10-15 16:40:16 +00:00
Collaborator

Fixed.

Cause — frontend/app/assets/css/colors.scss used red, green and gray as unquoted map keys. Sass parses those words as colour values, not strings, so theme-vars() interpolating them into --color-#{$name} triggered the "you probably don't mean to use the color value red in interpolation here" warning on every frontend build.

Change — frontend/app/assets/css/colors.scss: quoted the colour-named keys in both theme maps ("red", "green", "gray") so they stay strings, plus a short comment saying why. Nothing else in the file needed touching — the other keys (dark, light, background, the rarity-* keys, the accent maps) are not Sass colour keywords, and no other stylesheet reads these maps.

Verification

  • Compiled the file with sass 1.99 (the frontend's pinned version): the warning is gone, and the emitted CSS is byte-for-byte identical to the pre-fix output — --color-red: #e06c75, --color-green, --color-gray are still produced in both :root and [data-theme="light"], so the 17 var(--color-red|green|gray) usages in components keep resolving. (Confirmed the warning does appear when compiling the file at HEAD, so the fix is what removed it.)
  • Added tests/theme-color-vars.test.js, in the style of the existing source-reading tests: it extracts the $themes/$accents keys and asserts none is a bare CSS colour keyword, and that the three colour-named keys are quoted with their hex values in both maps. It fails against the pre-fix file and passes now.
  • npm test from the repo root: 246 tests, 246 pass, 0 fail.
Fixed. **Cause** — `frontend/app/assets/css/colors.scss` used `red`, `green` and `gray` as unquoted map keys. Sass parses those words as *colour values*, not strings, so `theme-vars()` interpolating them into `--color-#{$name}` triggered the "you probably don't mean to use the color value red in interpolation here" warning on every frontend build. **Change** — `frontend/app/assets/css/colors.scss`: quoted the colour-named keys in both theme maps (`"red"`, `"green"`, `"gray"`) so they stay strings, plus a short comment saying why. Nothing else in the file needed touching — the other keys (`dark`, `light`, `background`, the `rarity-*` keys, the accent maps) are not Sass colour keywords, and no other stylesheet reads these maps. **Verification** - Compiled the file with `sass` 1.99 (the frontend's pinned version): the warning is gone, and the emitted CSS is byte-for-byte identical to the pre-fix output — `--color-red: #e06c75`, `--color-green`, `--color-gray` are still produced in both `:root` and `[data-theme="light"]`, so the 17 `var(--color-red|green|gray)` usages in components keep resolving. (Confirmed the warning *does* appear when compiling the file at `HEAD`, so the fix is what removed it.) - Added `tests/theme-color-vars.test.js`, in the style of the existing source-reading tests: it extracts the `$themes`/`$accents` keys and asserts none is a bare CSS colour keyword, and that the three colour-named keys are quoted with their hex values in both maps. It fails against the pre-fix file and passes now. - `npm test` from the repo root: 246 tests, 246 pass, 0 fail.
Collaborator

Implementation is ready for review: #76

Implementation is ready for review: https://git.aranroig.com/Syndria98/dragonroll/pulls/76
Agent added help wanted and removed working labels 2026-10-15 16:44:09 +00:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Syndria98/dragonroll#71