Skip to content

[vite:css] [sass] $channel: Color hsl(205, 100%, 40%) has no channel named red #1032

@andreadisaro

Description

@andreadisaro

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @coreui/coreui@5.4.3 for the project I'm working on.

I'm sorry I cannot be 100% precise, but looks like with the new version of sass (I have 1.93.2) and vite (7.1.7) you would get the error in the title (I think it's raised when the color is HSL)

Here is the diff that solved my problem:

diff --git a/node_modules/@coreui/coreui/scss/functions/_contrast-ratio.scss b/node_modules/@coreui/coreui/scss/functions/_contrast-ratio.scss
index 8645d3e..221a5c8 100644
--- a/node_modules/@coreui/coreui/scss/functions/_contrast-ratio.scss
+++ b/node_modules/@coreui/coreui/scss/functions/_contrast-ratio.scss
@@ -19,9 +19,9 @@ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003
 // See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
 @function luminance($color) {
   $rgb: (
-    "r": color.channel($color, "red"),
-    "g": color.channel($color, "green"),
-    "b": color.channel($color, "blue")
+    "r": color.channel($color, "red", $space: rgb),
+    "g": color.channel($color, "green", $space: rgb),
+    "b": color.channel($color, "blue", $space: rgb)
   );
 
   @each $name, $value in $rgb {

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions