小编Pav*_*ank的帖子

如何在 scss 全局声明中使用 hsl 而不是 rgb javascript api

这就是我的 next.config.js 的样子

// next.config.js

const env = require('./site.config').env;
const Colour = require('sass').types.Color;
const {r, g, b} = require('./site.config').customProperties;

const withBundleAnalyzer = require('@next/bundle-analyzer')({enabled: !!process.env.ANALYZE});

const config = {
  env: {
    ...env,
  },
  sassOptions: {
    functions: {
      'primaryOpacityColour()': function(){
        return new Colour(r, g,b)
        // here I want to return Colour in hsl form
      },
    },
  },
};

module.exports = withBundleAnalyzer(config);
Run Code Online (Sandbox Code Playgroud)

我无法以 hsl 形式返回 Color,有人能帮我解决这个问题吗?

javascript globalization sass reactjs next.js

6
推荐指数
1
解决办法
99
查看次数

标签 统计

globalization ×1

javascript ×1

next.js ×1

reactjs ×1

sass ×1