是否可以将不透明度分配给 SCSS 十六进制颜色变量,重新使用该变量?

Is it possible to assign opacity to a SCSS hex color variable, re using that variable?

我有一系列 scss 变量代表在我的应用程序中重新使用的颜色,如下所示:

$first-color: #00755E

我也有与第一种颜色相同的颜色,但它们是带有不透明度的十六进制值。就像这里的 $first-color 一样,不透明度为 0.05。

$first-with-opacity: #F2F8F7

我想做的是在 $first-with-opacity 变量中重新使用这个 $first-color 变量,这样如果这个 $first-color 发生变化,我就没有还要更改 $first-with-opacity 以匹配具有相同不透明度的新颜色。

由于应用程序的限制,我无法在此场景和其他场景中使用 rgba 值。我想知道的是,我是否可以在不使用 rgba 的情况下重新使用该变量($first-color)并为其附加不透明度值?

需要说明的是,以下内容无效:

$first-with-opacity: rgba($color: $first-color, alpha: 0.05) //this solution will not work in this scenario

给你...

错误:

$first-with-opacity: rgba($color: $first-color, alpha: 0.05);

正确:

$first-with-opacity: rgba($first-color, 0.05);